Posts

Showing posts from May, 2012

ios - Get image name UIImagePickerController in Swift -

i use uiimagepickercontroller image phone library (ios). after edit mode put image uiimageview. want save image in core data use in view controllers how can in swift. if not possible options have save image ? another option can save image document directory of app , can retrieve image anywhere shown in below code: func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) { self.dismissviewcontrolleranimated(true, completion: nil) let tempimage = info[uiimagepickercontrolleroriginalimage] as! uiimage // save image here document directory saveimage(tempimage, path: fileindocumentsdirectory("tempimage")) } here helper functions: func saveimage (image: uiimage, path: string ) -> bool{ let pngimagedata = uiimagepngrepresentation(image) //let jpgimagedata = uiimagejpegrepresentation(image, 1.0) // if want save jpeg let result = pngimagedata.writetofile(path, atomic

Nested maps in Python 3 -

i want transform list list = [" , 1 ", " b , 2 "] nested list [["a","1"],["b","2"]] . the following works: f1_a = map(lambda x :[t.strip() t in x.split(',',1)],list) but not work python 3 (it work python 2.7!): f1_b = map(lambda x :map(lambda t:t.strip(),x.split(',',1)),list) why that? is there more concise way f1_4 achieve want? python 3's map returns map object, need convert list explicitly: f1_b = list(map(lambda x: list(map(lambda t: t.strip(), x.split(',', 1))), lst)) though in cases should prefer list comprehensions map calls: f1_a = [[t.strip() t in x.split(',', 1)] x in lst]

objective c - Error occur after add a UDP server and client -

i writing program using objective-c. going add udp server , client project, before add file xcode project, project can run successfully. after add mainudp.m , upd.h , upd.m, program cannot run , here error message, how cope issue? thanks ld /users/bacd/library/developer/xcode/deriveddata/dd-hggkyympepqrutcpbxxlwmtzcjkb/build/products/debug/dd.app/contents/macos/dd normal x86_64 cd /users/bacd/desktop/de export macosx_deployment_target=10.7 /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.10.sdk -l/users/bacd/library/developer/xcode/deriveddata/dd-hggkyympepqrutcpbxxlwmtzcjkb/build/products/debug -f/users/bacd/library/developer/xcode/deriveddata/dd-hggkyympepqrutcpbxxlwmtzcjkb/build/products/debug -f/users/bacd/desktop/de/bluewear\ osx -filelist /users/bacd/library/developer/xcode/deriveddata/dd-hggkyympepqrutcp

php - Display logged-in User Avatar in Wordpress Nav Menu -

i'm using function display logged-in user name in wordpress navigation menu , display logged-in user avatar in menu couldn't find way this. i'm asking :) here function i'm using name: function my_dynamic_menu_items( $menu_items ) { foreach ( $menu_items $menu_item ) { if ( '#current-username#' == $menu_item->title ) { global $shortcode_tags; if ( isset( $shortcode_tags['current-username'] ) ) { // or do_shortcode(), if must. $menu_item->title = call_user_func( $shortcode_tags['current-username'] ); } } } return $menu_items; } add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' ); i have code in functions.php , call #current-username# in menu item, there way customise code output avatar? help. try : echo get_avatar( $id_or_email, $size, $default, $alt );

firebase - Geofire query doesn't activate unless ctrl + f5 -

i using geofire library angularjs. noticed odd happening when writing out basic geolocation based query. upon state change, page displays blank , query doesn't appear execute. however, if ctrl + f5, data displays , query executes. i wondering why happening. i've included controller code below. appreciated, i've been trying numerous things (tried updating user's geolocation force event triggered, $timeout, etc). 'use strict'; angular .module('m02-discover') .controller('discovercontroller', [ '$scope', '$state', 'fbref', 'fbgeo', '$geofire', 'discover', '$timeout', function($scope, $state, fbref, fbgeo, $geofire, discover, $timeout) { var ref = new firebase(fbref); var georef = new firebase(fbref + 'geofire/'); var $geo = $geofire(georef); $scope.searchresults = []; var query = $geo.$query({

java - Issues with a tagging system using Autocomplete android -

i trying implement similar facebook's search system, if user starts typing in name brings autocomplete suggestions based on letters typed, , additional option search more results. each result object , not string, , have tried adding result search every time click on search or 1 of objects replace text occurs object oppose name , know method of autocomplete widget. there way go it? here code: private autocompletetextview sx; sx = (autocompletetextview) findviewbyid(r.id.sx); if(sadapter == null) { sadapter = new sadapter(postactivity.this, usersfound); sx.setadapter(sadapter); } sx.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { if (sx.gettext().tostring().length() <= 3 && sadapter != null) { usersfound.clear(); sadapter.notifyda

java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.Gallery$LayoutParams -

i trying add fancycoverflow in app,it works fine static image given in this example . but did changes in adapter, , try run app , crashes , shows following error fatal exception: main java.lang.classcastexception: android.view.viewgroup$layoutparams cannot cast android.widget.gallery$layoutparams @ android.widget.gallery.setupchild(gallery.java:889) @ android.widget.gallery.makeandaddview(gallery.java:858) @ android.widget.gallery.layout(gallery.java:665) @ android.widget.gallery.onlayout(gallery.java:357) @ android.view.view.layout(view.java:14118) @ android.view.viewgroup.layout(viewgroup.java:4467) @ android.widget.linearlayout.setchildframe(linearlayout.java:1670) @ android.widget.linearlayout.layoutvertical(linearlayout.java:1528) @ android.widget.linearlayout.onlayout(linearlayout.java:1441) @ android.view.view.layout(view.java:14118) @ android.view.viewgroup.layout(viewgroup.java:4467) @ android.widget.relativelayout.o

c - why do I have to declare an irrelevant struct file_handle variable before I can use that type? -

following documentation linux open_by_handle_at () : http://man7.org/linux/man-pages/man2/open_by_handle_at.2.html i write c file: #define _gnu_source #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> typedef void (*foobar) (struct file_handle *); but compiles ominous warning: >gcc -c foobar.c warning: ‘struct file_handle’ declared inside parameter list if add irrelevant declaration in between: #define _gnu_source #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> struct file_handle *junk; typedef void (*foobar) (struct file_handle *); then compiles without warning. why warning?? you haven't declared struct file_handle anywhere in advance. compiler sees struct file_handle in above function definitions first time ever. in each case declaration of struct file_handle has block scope, i.e. local corresponding function. add below structure before function. struct file_handle {

html5 - CSS vertical align block in a container -

fiddle any way align .col top, matching height of siblings above? here current solution maintaining equal height , width. <div class="row"> <div class="col">...</div> <div class="col">...</div> </div> .row { display: flex; /* assigns equal height children */ } .col { flex: 1; /* assigns, equal width*/ } this solution backwards support browser such ie8,9 : .row { display: table; } .col { display: table-cell; width: 50%; /* depends on number of columns, 50% 2 col, 25% 4 column , on*/ }

How to set options for bash script -

this question has answer here: example of how use getopts in bash 4 answers if have script called program , want set option if -p entered option program echoes "polly want cracker", how should go use getopt this? i give little example can develop own needs : #!/bin/bash while getopts "bp" option case $option in b) echo "polly want banana" ;; p) echo "polly want cracker" ;; esac done

ant token and regrex to replace string -

am trying replace value on multiples temp directory. temp directory have multiple subfolders , each folder has file called local.q in need replace string clus(test),clus(test1),clust(test2) clust(qae). tried below options using filter , regrex throws error. java.util.regex.patternsyntaxexception: dangling meta character . please me on this? <replaceregexp match="clus(*)" replace="clus(${clusvalue})" flags="g" byline="true"> <fileset dir="${temp.dir.q}" includes="**/*.q"/> </replaceregexp>

django - Rest Framework: HyperlinkedRelatedField, return multiple attributes? -

django rest framework's hyperlinkedrelatedfield used serialize related fields this: 'tracks': [ 'http://www.example.com/api/tracks/45/', 'http://www.example.com/api/tracks/46/', 'http://www.example.com/api/tracks/47/' ] i'm looking way return multiple attributes, like: 'tracks': [ {'id': 45, 'href': 'http://www.example.com/api/tracks/45/'}, {'id': 46, 'href': 'http://www.example.com/api/tracks/46/'}, {'id': 47, 'href': 'http://www.example.com/api/tracks/47/'} ] is there way achieve using drf's standard serializers? you use nested serializer that. serializers in drf usable fields: class trackserializer(modelserializer): class meta: model = track fields = ('id', 'href') class yourmodelserializer(modelserializer): tracks = trackserializer(many=true) you have examples in official

Create tasks in Visual Studio Code per user -

Image
when created node task visual studio code created tasks.json file inside .settings folder folder have open (node-app in case shown in image below). ie: creates task per folder. { "version": "0.1.0", "command": "node", "isshellcommand": true, "args": ["${file}"] } my question how create task per user rather project based task can execute node code folder rather having create same task each folder open in visual studio code. also how execute individual files without opening folder.

java - Remove folder in bitbucket -

i had eclipse project in bitbucket in bitbucket. changed package name of project , attempted push not let me used git push -f , pushed new package name kept old 1 also. not sure happened since new git. how delete old 1 or how complete remove in bitbucket repo , have have new package name? if eclipse did rename package, means should not have anymore old folder representing old package. switch command line, , confirm git status : should show old package deleted. if so: cd /path/to/your/project/src git add -a . git commit -m "record deletion of old package" git push then bitbucket reflect deletion of old package.

The "-" key goes up a line in vim -

when hit "-" key on keyboard vim goes line. .vimrc blank , when type in :map - vim says "no mappings found." have no idea causing this. using mac—could terminal.app problem? thanks from :help - (it isn't mapped, motion command) - <minus> [count] lines upward, on first non-blank character |linewise|. and + same downward.

Fortran compiler for mac to read program -

i'm using g77 compiler (on terminal type g77 filename.for ) on mac. can't read fortran program , can't modify program (very old program, not mine, , need output it). suggestion compiler read program? here kind of error get: android-ae71922e0bc4a747:~ jadecheclair$ g77 geomalb.for geomalb.for: in program `geometric': geomalb.for:61: accept *,fhaze 1 2 unrecognized statement name @ (1) , invalid form assignment or statement-function definition @ (2) the accept statement not part of fotran standard. non-standard extension , therefore program not fortran 77 program , cannot expect compilers compile it. notably, g77 not support extension https://gcc.gnu.org/onlinedocs/g77/type-and-accept-i_002fo-statements.html modern successor of g77 - gfortran - not support either. you can try intel compiler (costs money), oracle compiler (free linux, not available mac) or (much better) convert source code fortran changing accept read .

android - Translated view (AppBarLayout) is put back in its original position -

Image
i'm on api 22. orange view appbarlayout inside coordinatorlayout . i'm trying make disappear translating top. want out of screen. i'm getting translation height from: appbarlayout bar; rect r = new rect(); bar.getlocalvisiblerect(r ); float h = r.height(); animated call bar.animate().translationy(-h) , on; (tried viewcompat.animate(bar), new translateanimation(), ...) direct call direct call bar.settranslationy(-h) . problem gets instantly replaced @ previous place, , translation gets 0 (i.e., bar.gettranslationy() == 0 , if have set -h ). spent hours on this; might think maybe it's not possible; coordinatorlayout not allowing such behavior that's not true. exact same code works like charm on api17, , in last hours failed see why should not on api22. appreciate help, either in understanding why not possible, or what's difference between api17 & api22 causes this. or, maybe, how around problem. sorry low framerate. ( side quest

I have a php login script which connects to a MySQL Database and my else statement doesn't run -

this question has answer here: can mix mysql apis in php? 5 answers here end login page first checks username against database if user exists if checks password against user in data base if match log in if don't don't log in. , part works fine if username not exist (and wrote supposed catch that) blank white page not intended result. can point out code breaking?? <?php /* handles login requests */ define('db_host', 'localhost'); define('db_name', 'sec_usr'); define('db_user', 'sec_usr'); define('db_pass', 'n89tzah2w3uf4guu'); $con=mysql_connect(db_host,db_user,db_pass) or die("failed connect mysql: " . mysql_error()); $db=mysql_select_db(db_name, $con) or die("failed connect mysql: " . mysql_error()); /* $id=$_post['user']; $password = $_post['pass

java - Dynamic WebProject import another project and dependencies -

i have dynamic web project call "project a" , regular java project call "project b" in eclipse. have added project b b project going project properties properties -> deployment assembly -> add -> project . works , adds jar "project b.jar" project a/web-inf/lib folder. external jar files configured on "project b" not included in "project b.jar". additionally have gone project b -> properties -> java build path -> order , export , have checked required dependencies "project b" , still not include them in jar. how can eclipse include these jars in "project b.jar" file. if need know i'm using eclipse indigo , not using mavin project 1 jar need. in advance. you should turn project b faceted form (go project properties, "project facets" -> "convert faceted form..."). facets required "java" , "utility module". if remember correctly, @ point

javascript - ExpressJS: What's the difference between ?, +, * in string patterns and regexes? -

hi i'm new express , although have scoured internet complete explanation of string patterns haven't found any. documentation path-to-regexp doesn't seem help, either. specifically, i'm trying interpret (imo rather cryptic) remark in documentation: the characters ?, +, *, , () subsets of regular expression counterparts. see http://expressjs.com/guide/routing.html how differently these characters behave between regexes , string patterns? know of complete list of characters deemed special in express strings, explanations supposed do? cheers from examples looks + , ? behave you'd expect in regexes, , * equivalent regex .* . that's string patterns - actual regex ones further down behave you'd expect.

python - Why does '12345'.count('') return 6 and not 5? -

>>> '12345'.count('') 6 why happen? if there 5 characters in string, why count function returning 1 more? also, there more effective way of counting characters in string? count returns how many times object occurs in list, if count occurrences of '' 6 because empty string @ beginning, end, , in between each letter. use len function find length of string.

Java inner classes and static methods or fields -

why can't inner classes have static (non-final) fields , methods? this question has been posted before posted answers were: it's design decision or because inner classes happen in context of outer class , cannot declare static methods. yet these answers not clarify question. consequences of allowing static fields , methods on inner classes? guess both restrictions connected. since static methods require access other static methods , non-final static variables of inner class or outer class (to able change internal states), lead inner class behave static one. jvm limit access static methods in inner classes static methods , data inside inner class, though. yet raises question: why can't declare static non-final variables inside inner classes? is design or there problems? kind regards declaring static variables in non-static inner class seems contradictory intend of creating inner non-static class. if declaring variables , methods static when make sense a

javascript - Adding an Image to HTML Based on Outcome of If/Else (innerHTML? DOM?) -

i'm doing basic rock paper scissors game in javascript, nothing new i'm trying fancy little. of ones see output computer selected in plain text via innerhtml , that's fine want show image based on selected. the basic game function playgame passes choice comparechoices function. instead of passing "the computer chose: rock" span id="result" pass image. i've been reading dom , nodes , stuff i'm having difficulty understanding how apply here. let's assume have image named rock.gif want pass result span when computer selects "rock". how do it? if involves using dom , not innerhtml please me understand , explain little going on. thanks! function playgame(userselect) { useroption = userselect; var computerselection = math.random(); if (computerselection < 0.34) { computerselection = "rock"; } else if (computerselection <= 0.67) { computerselection = "paper"; } else { computerselction = &

multithreading - externally ending infinite loop java -

i'm writing program mark algorithm submitted group of students. plan on copying algorithm method program , running see results; however, required algorithm not run more 10 seconds. i constructed executorservice end algorithm works userinput algorithm (commented out) did not work infinite loop. from know threads, interrupting require altering algorithm (add flag), , stopping thread depreciated, there other way end infinite loop without altering algorithm in anyway? here's code: public class testalgo{ private string move; public static void main(string[] args){ testalgo testalgo = new testalgo(); testalgo.rungame(); } public void rungame(){ cram game = new cram(); boolean start = game.startgame(); while (start){ executorservice executor = executors.newsinglethreadexecutor();///// future<string> future = executor.submit(new task());///// move = ""; try { system.out.println("started

php - how to show user details -

hello have code in welcome.php when user login using login.php being redirected redirect.php welcome.php <?php session_start(); if(isset($_session['username'])) { echo'<h1>welcome ' . $_session['username'] . '</h1>'; echo'<h1>welcome ' . $_session['r'] . '</h1>'; echo'<br> <h1> <a href="logout.php">logout</a> </h1>'; } else { echo 'you not logged in <br>'; echo'<a href="index.php">login</a>'; } ?> i want show r mysql database can't searched many time couldn't find answer anyhelp? i use when member logs in. query database user set session variables //retrieve username , password login feilds $uname = clean($_post['uname']); $password = clean($_post['password']); //query database $qry="select * tbl_members username='$uname' , pa

ios - How do I detect when a user changes the month or week in JTCalendar? -

does know how detect month or week changes in jtcalendar ? don't see events in documentation. thanks. you can use jtcalander delegate method - (void)calendardidloadpreviouspage:(jtcalendarmanager *)calendar{ } - (void)calendardidloadnextpage:(jtcalendarmanager *)calendar{ }

Reading text file line by line in c++ -

i want read text text file c++ code. here code:- f.open(input); if (f) { while(!f.eof()) { linkedlist obj; string c, d, l; f>>c>>d>>l; nodes.push_back(c); nodes.push_back(d); vector<string> temp; temp.push_back(c); temp.push_back(d); temp.push_back(l); vecnodes.push_back(temp); } } my text file below: a b c c d e e g h my question how can read 1 line @ 1 time. when code read second line go read first character of third line wrong. know can put delimiter @ end of each line might work. there other way this? you can read line line file following code : string line; ifstream myfile; myfile.open("myfile.txt"); if(!myfile.is_open()) { perror("error open"); exit(exit_failure); } while(getline(myfile, line)) { // things here } then split space string , add elements in list.

regex - RunTime Error on VBA Macro -

i working on vba code grab text outlook email , place in excel sheet have set up. using excel 2010. email contains following information: company: abc company class period: 2013-10-29 through 2014-10-22 i have set loop go through email , insert company name in column a, first date (2013-10-29) in column b , other date (2014-10-22) in column c. when run code receive error states: run-time error 5: invalid procedure call or argument on below line of code: vtext2 = trim(m.submatches(2)) could please let me know doing wrong. part of code below. let me know if need provide additional information. stext = olitem.body set reg1 = createobject("vbscript.regexp") = 1 3 reg1 select case case 1 .pattern(company\s[:]+\s(\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*\w*\s*)\n)" .global = false case 2 .pattern = "(class period\s*[:]+\s*([\d-\s]*))" .global = false case 3 .pattern = "(through+\s*([\d-\s]*))" .global = false end select end i

Kendo UI grid aggregate using groups and Razor syntax -

here grid (bit simplified): @(html.kendo().grid().columns(columns => { columns.bound(x => x.timestamp).hidden(true) .clientgroupheadertemplate("#= value #"); columns.bound(x => x.net); columns.bound(x => x.gros); columns.bound(x => x.total) .clientgroupfootertemplate("# sum #"); }) .pageable(p => p.enabled(false)) .sortable(s => s.enabled(false)) .groupable(g => g.enabled(false)) .scrollable(s => s.enabled(false)) .datasource(source => source .ajax() .aggregates(aggregates => { aggregates.add(c => c.net).sum(); aggregates.add(c => c.gros).sum(); aggregates.add(c => c.total).sum(); }) .group(groups => { groups.add(c => c.timestamp); }))) it shows grid order positions grouped time added, group headers show timestamp, group footers show total sums

cordova - Windows Phone claims, that my PhoneGap Build app uses location services -

according my application's config.xml , application using 5 plugins: <gap:plugin name="com.phonegap.plugins.barcodescanner" version="2.0.0" /> <gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" /> <gap:plugin name="org.apache.cordova.vibration" version="0.3.11" /> <gap:plugin name="com.verso.cordova.clipboard" version="0.1.0" /> <gap:plugin name="com.google.cordova.admob" version= "2.7.7" source="plugins.cordova.io" /> and 1 feature: <feature name="http://api.phonegap.com/1.0/device" /> there isn't tiny trace of localization. but, according windows phone store , app using location services. same confirmed, when application installed -- windows phone displays standard reminder, location data gathered particular application may sent microsoft servers blah, blah... thing is, app not using geolocatio

php - Shortening URL using .htaccess -

my folder structure is: modules admin index.php login login.php signup.php articles articles.php my current url is: localhost/modules/admin/index.php localhost/modules/login/login.php localhost/modules/articles/articles.php i want change to: localhost/index localhost/login localhost/articles since beginner in using .htaccess file, pls me how can change url using .htaccess file your folder structure makes difficult have universal rule should able use these rules. rewriteengine on rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule ^ - [l] rewriterule ^(index)/?$ /modules/admin/$1.php [nc,l,qsa] rewriterule ^(login|articles)/?$ /modules/$1/$1.php [nc,l,qsa]

cryptography - How does driver signing work when Windows is offline? -

i understand basics of signing. must have private key , certificate (not necessarily) reputable certificate authority. must have public key of signer verify integrity. i can see working online; site given certificate (not necessarily) reputable certificate authority (such verisign example), , firefox (for example) can check authenticity of certificate contacting said certificate authority. yes, know can sign things self-generated certificate, firefox complain when happens , windows when installing 3rd-party driver. my question thus; how windows know driver signed reputable certificate authority when offline , can't check said reputable certificate authority? does windows keep collection of public keys reputable certificate authorities within windows? wouldn't 1 able alter list load driver if had certificate of reputable certificate authority? how driver signing work offline? yes, windows keeps collection of trusted root certificates. software, such ie ,

css - Can't get a sticky footer working for the life of me -

i've tried every css-only implementation of sticky footers exist on internet seems, , life of me cannot figure out why it's not working me. the problem code here: https://jsfiddle.net/7ck2xk2p/1/ so problem footer still sitting under content, , not stuck bottom of page. as might able see, recent attempt technique detailed here ryan fait * { margin: 0; } html, body { height: 100%; } .wrapper { min-height: 100%; height: auto !important; /* line , next line not necessary unless need ie6 support */ height: 100%; margin: 0 auto -155px; /* bottom margin negative value of footer's height */ } .footer, .push { height: 155px; /* .push must same height .footer */ } i new, if things messy in fiddle please excuse me. relevant details should still distinguishable though. what doing wrong? you can use approach sticky footer (css only) html, body { height: 100%; margin: 0; } div { min-height: 100%; /* equal footer heigh

javascript - LoDash - How to push one collections values into another via common key -

i have 2 collections. var = [ {unique_id: "001", state: "co"}, {unique_id: "001", state: "tx"}, {unique_id: "001", state: "cc"}, {unique_id: "002", state: "cc"}, {unique_id: "002", state: "ny"} ] and var b = [ {unique_id: "001", states:[]}, {unique_id: "002", states:[]} ] and want get: var b = [ {unique_id: "001", states:["co","tx","cc"]}, {unique_id: "002", states:["cc","ny"]} ] i should mention "b" array has stay in same order it's in , of unique_id's don't have value. i've been trying use lodash https://lodash.com/ - if can solve lodash awesome! the time complexity of solution suboptimal ( o(n^2) ), might think of ways match pushing values "b": _.foreach(a, function(element1){ _.foreach(b, function(element2){ if (

Using Bulk Copy Program / Linked Server to transfer Excel-VBA file into SQL server -

i have excel-vba file 15000 rows , 4 columns. need insert 2 of columns microsoft sql management studio. have been looking @ youtube tutorials how new got lost. i have tried convert file .text file insert sql server. tried linked server method did not seem work -- if have advice on way make work instead, welcome well! code in ssms: create table exporttool(tooling_sheet carchar, tools varchar) insert exporttool values "insert range here... select * exporttool ** edited code in ssms: ** create table importtool(tooling_sheet carchar, tools varchar) bulk insert dbo.importtool openrowset('microsoft.jet.oledb.4.0', 'j:\test-tds\tools.text'); ( /* insert range here */ ) select * importtool using cmd: dev.dbo.exporttool out j:\test-tds\tools.txt -t -c enter: gave output 0 rows copied dev.dbo.exporttool out j:\test-tds\tools.text -t -c enter: gave output : error = unable open bcp host data-file am typing cmd incorrectly not cop

java - Android - active rendering in game loop? -

best way render in game loop on android? when i'm rendering in java know how this. create buffer strategy, graphics, draw, dispose , flip buffer. there andorid equivalent of that? looked view, doesn't work correctly when try draw lot. looked surfaceview than, can't understand how can refresh drawing on it. invalidate breaks loop, postinvalidate doesn't work. lock canvas , draw on it, , unlock , post in "create" method surface view (locking canvas in loop doesn't work, white screen in app appears). don't it. what's efficient way render heavily in android? the common approach render within surfaceview through surfaceholder . usually you'll canvas through holder , draw on it: surfaceholder surfaceholder = surfaceview.getholder(); canvas canvas = surfaceholder.getsurface().lockcanvas(); //draw in canvas canvas.drawpoint(...); surfaceholder.unlockcanvasandpost(canvas); the correct approach loop code between lockcanvas

Windows Phone Contacts App - How to get kind of returned number? -

i creating windows phone 8.1 runtime app. contacts viewer people manage contacts. want display contacts data values exist... name, phone, address, etc. if see when edit contact, can add 2 phone numbers mobile phone, home phone , work phone. when list values using contactphone.kind , returns mobile, home or work, without indicating if it's 1 or 2! that's good, how can know if number 1 or number 2? for example if contact has mobile 1 , mobile 2 info entered, both show in app mobile. if have contact has mobile 2 entered, when displayed in app, contact phone kind says mobile... is there way know mobile 2? ..... more information after more research: to further extend question, added sample contact using standard people app, , added phone numbers: mobile, mobile 2, home, home 2, work, work 2, company, pager, home fax, work fax when check contact phone kind each number contained in contact's phones, get: mobile, mobile, home, home, work, work, work, oth

regex - On using clojure, with string more than 205 character facing StackOverflowError clojure.lang.AFn.applyToHelper (AFn.java:155)? -

i using clojure lein repl. using frak tool ( https://github.com/noprompt/frak ) create regex long strings. however, string fed more 205 character, gives stackoverflow error: frak=> (frak/pattern ["f" "quuxfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffssssssssssssssssssssrrrrrrrrrrrrrrrrrrrrrrrgtgggggg345g"]) stackoverflowerror clojure.lang.afn.applytohelper (afn.java:155) this issue seems specific machine passing in other machines. i tried following outputs: frak=> (defn stack-depth [n] #_=> (try #_=> (stack-depth (inc n)) #_=> (catch stackoverflowerror _ #_=> (str "max stack depth " n)))) #'frak/stack-depth frak=> (stack-depth 1) "max stack depth 8439" frak=> (stack-depth 1) "max stack depth 8439" frak=> (stack-depth 1) "max stack depth 8439"

phalcon - How to add a new index to an existing array on Volt? -

so have existing array, want run loop through , recreate new arrays. trying figure out how create own array directly on volt. here code: {% set onomesagendaamigos = [], onomesagendarecomendado = [], onomesagendaamigosrecomendado = [] %} {% onomeagenda in onomesagenda %} {% set onomesagendastotal = onomeagenda.cliente_nome %} {% if onomeagenda.ind_amigo == 1 %} {% set onomesagendaamigos = onomeagenda %} {% endif %} {% if onomeagenda.ind_recomendado == 1 %} {% set onomesagendarecomendado = onomeagenda.cliente_nome %} {% endif %} {% if onomeagenda.ind_recomendado == 1 , onomeagenda.ind_amigo == 1 %} {% set onomesagendaamigosrecomendado = onomeagenda.cliente_nome %} {% endif %} {% endfor %} last time have checked there no mechanism setting table bit bit in volt. walk-around use array_merge() or implement own filter/method volt engine. anyway it's bit against mvc principles. should set tables need on php p

mongoose getting Model validation failed instead of custom error message -

i'm sure issue password validator because if comment out document gets inserted. if enter valid password works. here entire userschema var userschema = new schema({ firstname: string, lastname: string, email: { type: string, unique: true, match: /.+\@.+\..+/ }, website: { type: string, set: urlmodifier }, username: { type: string, trim: true, required: true, unique: true }, password: { type: string, validate: [ function(password) { return password.length >= 6; }, 'password should longer' ] }, createdat: { type: date, default: date.now }, role: { type: string, enum: ['admin', 'owner', 'user'] } }); this issue i'm having instead of custom error message get validationerror: user validation failed <br> &nbsp; &a

java - How to GET last dates within a certain constraint -

i trying figure out how can pull records mongo database using jongo check date on object in db , return object data from, in case, last 3 current dates. i'm using localdate set date on object. so that's problem, i'm doing have angularjs web ui interfaces java backend , i'm trying scale down scope, because current way i'm displaying data not feasibly scalable. want limit response receive last 3 objects created instead of of objects. , i'm point need check on date can't seem find reasonable solution. isafter() , isbefore() started initial effort, can't guarantee dates in way don't know set constraints. the code i'm working on doesn't matter, i'm more interested in how can check in general. thanks in advance help, if @ all, can offered!

c++ - OpenGL, Access violation -

i making opengl project in visual studio 2010. following tutorial youtube. don't know error is, , have error: unhandled exception @ 0x00000000 in opengl first game.exe: 0xc0000005: access violation. main.cpp #include <gl/glew.h> #include <iostream> #include <gl/glut.h> #include "sprite.h" sprite _sprite; void init() { glclearcolor(0.0f, 1.0f, 1.0f, 1.0f); _sprite.init(-1.0f, -1.0f, 1.0f, 1.0f); } void render() { glcleardepth(1.0); glclear(gl_color_buffer_bit | gl_depth_buffer_bit); _sprite.render(); glutswapbuffers(); } int main(int argc, char** argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_depth | glut_double | glut_rgba); glutinitwindowposition(520, 200); glutinitwindowsize(800, 600); glutinitdisplaymode(glut_double); glutcreatewindow("opengl [ 1 ]"); glutdisplayfunc(render); init(); glutmainloop(); } sprite.cpp #include <gl/glew.h> #include &q

jquery - execute SetTimeout or $timeout only on some action -

how can trigger either settimeout or $timeout on button click. right if put inside button click function getting executed on own not waiting click event trigger it. $scope.btnclick = function () { settimeout(function () { $scope.close(); }, 1000) } use $timeout instead of settimeout , use $scope.$apply() in "$scope.close()" function. note: if want see changes in ui , may use $scope.$apply() in function. using console.log() doesn't prove words ;)

r - In ETS packages can u use high frequency f=365..? -

Image
i using forecast function ..and ts() ,using f=365.........and able see gud day wise seasonality..in hyndman sir blog read "i asked how fit arima or ets model data hav­ing long sea­sonal period such 365 daily data or 48 half-​​hourly data. gen­er­ally, sea­sonal ver­sions of arima , ets mod­els designed shorter peri­ods such 12 monthly data or 4 quar­terly data" in stackover flow, got know forecast() use ets function..what correct .. pls suggest!! if you're not using r, can same thing in tableau workbook. right-click forecast area , select describe forecast... give of quality metrics well.

javascript - google maps directions service not showing route -

i used simple directions service api sample provided google maps api, while map seem adjust show 2 different points, there no route or markers plotted. directions-simple here have: var directionsdisplay; var directionsservice = new google.maps.directionsservice(); var map; function initialize(data) { directionsdisplay = new google.maps.directionsrenderer(); var chicago = new google.maps.latlng(41.850033, -87.6500523); var mapoptions = { zoom:7, center: chicago }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); directionsdisplay.setmap(map); } function calcroute() { var start = "chicago, il"; var end = "st louis, mo"; var request = { origin:start, destination:end, travelmode: google.maps.travelmode.driving };

android - Selector drawable strange behavior: why does it get stuck in the middle of the screen? -

Image
i've tried several combinations of selectors, end result same. though selector displayed correctly, if go or down selector stays in middle of screen. it's issue , couldn't make work or other solutions i've found. here selecting row: and scrolling down: my listview: <listview android:id="@+id/cardlistview" android:background="@android:color/black" android:listselector="@drawable/list_view_selector" android:layout_width="fill_parent" android:layout_height="fill_parent"/> my list_view_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/background_selected" /> <item android:drawable="@drawable/background_selected" /> </selector>