Posts

Showing posts from January, 2011

filesystems - Is there a way to automatically make a copy of a file each time it is updated in Unix? -

i have application updates files in unix server. since cannot modify application, there way can make sure these files copied before each update can have history of changes? there way/tool in unix can that? if on linux (specifically) use inotify(7) facilities (perhaps via incrontab ...) alternatively, might run periodically (thru crontab(5)  entry) script doing make particular makefile (since gnu make designed care timestamps) managing e.g. backups. or periodically run rsync command. however, smells need revision control (also known version control system). recommend git ; use before , after running application (e.g. write wrapping shell script doing that). but there no universal solution (e.g. if monitored application keeping file descriptor opened long time, , write file little little...). should explain more happening , want ...

javascript - Which is the best data grid for huge data handling on multiple devices? -

which best cross browser compatible data grid of javascript huge data handling on multiple devices (including pc, mobile, tablets) having best features , futuristic development approach ? have searched following grids: d-grid (not provide grouping & multilingual support) grid-x (not provide grouping & multilingual support) ui-grid dhtmlx telerik kendo ui jqwidgets grid i looking at-least features below: nested sorting searching/filtering ui live data editing/updating multi-language support drag , drop of rows/cols supports summary rows re-sizable , sort-able , hide-able columns supports grouping rows collapsible sections kindly suggest best one. i have experience kendo grid only. can kendo grid has many features isn't perfect handling huge data. there problem rendering. every time data changed (filtering, sort, add, remove, edit...) grid re-rendered. if grid includes many rows , columns, there performance problem. can partly solved pagi

objective c - One Array - Multiple sections - NSIndexPath -

i have 1 big array many values. i've sorted out sections can't seem indexpath right. basically, i'm trying do, if previous section has 50 rows, next indexpath.row should 51->. 1 after should 60-> , fourth. nslog(@"current indexpath.row: %ld",(long)indexpath.row); nslog(@"current section: %ld",(long)indexpath.section); (int = indexpath.section; == indexpath.section; i++) { nslog(@"number of rows: %ld",(long)[self tableview:tableview numberofrowsinsection:indexpath.section]); nslog(@"in section: %ld",(long)indexpath.section); if (i++) { // add previous number of rows plus current int previousrows = [self tableview:tableview numberofrowsinsection:indexpath.section*2]; nslog(@"now indexpath: %ld",(long)previousrows+indexpath.row); } } i hope i've made question clear enough understand. nsindexpath doesn't work way. nsindexpath starts 0 eve

sql server - Entity Framework - Update and Delete at same time -

i want update record , delete @ same time in entity framework. can ? or straight way, first update record , delete ? my scenario: i want delete record. before deleting record, want add comment(which column in table), why deleting record. if think, why add comment while anyway deleting record, here doing. if change made record, there trigger creates log record in audit table. so, want log comment. my concern update , deleting using 2 commands create 2 log records. you cannot update record , simultaneously delete in same operation in sql server, whether use entity framework or not. it's possible update , delete in context of same transaction , still 2 separate sql operations , logging trigger fire both times. if possible modify logging, write trigger code special logic ensure have 1 log entry, have address @ level rather @ database operation level.

php - Change class after depending on received data? -

i have jquery script sends request check_username.php checks in database if username available , echoes true or false , it's working. however when type form username doesn't exists form turns green, good, once enter username exists turns form red , no matter username type stay red. how solve this? jquery <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script> $(document).ready(function() { $("#username").keyup(function(e) { var username = $("#username").val(); $.post('check_username.php', {'username': username}, function(data) { if(data=="true") { $("#usergroup").addclass("input-group has-error"); } else if(data=="false"){ $("#usergroup").addclass("input-group has-suc

performance - How to test page speeds for websites hosted locally? -

i need tools test page load speeds websites hosted locally on lan, , not accessible via wan connections. in past using firefox yslow , page speed helped me lot, since latest firefox version (in case 39.0) yslow buggy , page speed disappeared firebug. new tools can installed these performance tests? i'd suggest yslow command line if you're finding plug in buggy. i'd suggest google chrome developer tools alternative firebug.

sql server - How does RavenDb Sql Replication Work? -

i've looked through ravendb documentation can't seem see how works, poll database or use sort of notification sqldependency? sql replication in ravendb watch changes inside ravendb , apply script supplied send it. doesn't use polling

using ioremap over kernel memory boot time reservation -

firstly have admit i'm newbie. don't go hard on me plz. want reserve memory @ boot time , use memory in kernel module in order sure module 1 using space . m going : add mem= , , memmap= kerenl parameters reserve memory @ boot time . questions begin here : if use ioremap on space in module code accessible in other modules ? or other kernel subsystems cant still see it? second question : how can sure reserved memory never move swap space ? third 1 : how can access memory block devices ? mean /dev/sda or ..... . (1) using ioremap , you're establishing kernel virtual address memory. other code in kernel space can access sticking right value pointer variable. afaik, there's no way of "locking" area of memory single kernel module. parts of kernel all-powerful , hence can access memory -- or @ least, can operations might required allow them access memory like. same token, there no reason piece of kernel code going access memory unless cause someh

Query on c++ iterator tag -

i going through code snippet template <class raiter> void alg(raiter, raiter, std::random_access_iterator_tag) { std::cout << "alg() called random-access iterator\n"; } for first time, seeing data types in function parameter section (std::random_access_iterator_tag). used seeing [std::random_access_iterator_tag rand_iter;] this sort of representation allowed in templates not in non-templated functions. two questions: 1) why data type name mentioned no variable of mentioned? 2) why allowed templated functions not non-templated functions? actually that's not related templates @ all. it's unnamed parameter , it's legal when: declaring method (so have no body) defining method won't use argument basically can respect signature without having named argument @ costs, eg: float foo(float, int, float); int main() { float x = foo(10.0f, 5, 20.0f); return 0; } float foo(float a, int, float b) { return a+b; }

java - Wrong column type Hibernate -

i have enum , want store integer in database. put annotation @enumerated(value=enumtype.ordinal) @ attribute , start application hibernate.validate. says following: wrong column type in administation column job. found: int, expected: varchar(255) does have clue why that? edit my enum looks following: public enum jobenum { private int value; private string name; private string description; private string classname; private boolean unique; private jobenum(int value, string name, string description, string classname, boolean unique) { this.name = name; this.description = description; this.classname = classname; this.unique = unique; this.value = value; } } and of course has getters values. my table named administration , has column job of type integer , can null.

javascript - Concat or not to concat external scripts? -

my site uses variety of js scripts. ones write, concat 1 master js file. i have number of external scripts things pinterist sharing, or google's places api. should these downloaded , concatenated master js file or should leave them separate call each of apis, so: <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places"></script> i think concatination of external scripts bad idea. what security fixes , updates? loose of that. many resources google etc updated regularly, have check it, download , concatinate. work 'having 1 master js file'.

java - How can I mock a local final variable -

there local variable in method final. how can mock? public void method(){ final int i=myservice.getnumber(); } i want mock when(myservice.getnumber()).thenreturn(1); how can complete mocking? my project using java 7, there way using reflection or else realize mock this request, stated, doesn't make sense. mocking systems don't mock variables (or fields). could, however, set field object have mocked. test this: @test public void methodwithnumberone { myservice myservice = mockito.mock(myservice.class); when(myservice.getnumber()).thenreturn(1); // might want set myservice constructor argument, instead. systemundertest systemundertest = new systemundertest(); systemundertest.myservice = myservice; systemundertest.method(); } another way set doesn't require mocks: public void method() { method(myservice.getnumber()); } /** use testing, set arbitrary number. */ void method(final int i) { // ... }

When to use helper methods and private methods in Rails? -

i have been hearing controller should concise possible. so, try keep of processing work in helper corresponding controller. but, little confused regarding whether should instead use private controller methods or helper methods. i using helper methods processing , returning values. have no other usage now. not called views. that's bad idea in general. helper methods shouldn't used except specific convert-something-into-string stuff (basically, should used only in views ). for else, should use service objects or similar, basically, poro (plain old ruby objects) in controllers want handle authentication , render right thing, don't want deal else otherwise become complex. you might want check these books improve knowledge topic: growing rails applications book on how avoid putting code in wrong places , how keep codebase maintenable on long term poodr ruby guide on how write object-oriented code, it's must any developer , understand why using he

php - Combine four foreach into one foreach? -

i trying add 4 foreach one. know how add 2 foreach 1 : foreach (array_combine($images, $covers) $image => $cover) { but want add more 2 foreach $titles $title , $albums $album . not sure want : foreach (array_combine($images, $covers) $image => $cover) { foreach (array_combine($titles, $albums) $title => $album) { echo "$image-$cover-$title-$album" it show me duplicate of every output.i mean output is demo-demo1-demo2-demo3demo-demo1-demo2-demo3 need output demo-demo1-demo2-demo3 put each statement in function. create loop calls it. public function loopme($images, $covers) { foreach (array_combine($images, $covers) $image => $cover) { $this->loopme($image,$cover); } } it looks second loop being called multiple times per item in first loop. want make sure calling second loop once per image cover. or set index cap on second loop. instance if tyring map first item in first loop first it

branch - Cleaning a Git repository with rebase remote branches -

we aworking on project git, guy launch project , create git repository doesn't explain team how correctly , use git. arrived team last week , have been charged clean repositories messy. first of all, there 13 sub-projects 13 repositories 1 final project. , 13 repositories has been badly used. example, repositories, there master branches unused since last march month... , there second branch develop directly used each developer. last week tried explain how have better use of git branching , commands new team, think applied. @ moment enjoy again branching model in our repository. at time, first, rebase remote branch develop on remote master branch date master branch (in end, "production" branch). then keep develop branch renamed pre-production , used tag system each delivery on pre-production server and conclude have third branch: new develop used (with pull request etc.) developers. so can safely rebase remote develop branch on remote master branch ? o

Goto statement in python - what other way is there? -

my program has following scturcutre program takes screenshot 2, program looks condition a. if condition not met, need go point 1 program looks condition b. if condition b not met, need go point 1 program looks condition c. if condition c not met, need go point 1 ... etc there around 20 additional conditions , whenever 1 of them not met, program should return starting point. goto statement solved. however, in python not option. suggestions appreciated how can implemented elegantly. you should give code, or @ least example showing structure is. maybe so: take screenshot condition = (condition a) , (condition b) , ... , (condition z) while (not condition): take screenshot condition = (condition a) , (condition b) , ... , (condition z)

osx - Tell cmake take another version of the package -

i have opencv , opencv3 installed via homebrew. opencv linked , can reached cmake via /usr/local/share/opencv opencv3 not linked , located here /usr/local/cellar/opencv3/3.0.0 i have cmakelists.txt file: cmake_minimum_required(version 2.8) project( displayimage ) find_package( opencv required ) add_executable( displayimage displayimage.cpp ) target_link_libraries( displayimage ${opencv_libs} ) when run cmake , uses first version of opencv. how can tell cmake use second package? update: i tried specify set(cmake_module_path ${cmake_module_path} "/usr/local/cellar/opencv3/3.0.0/share/opencv") find_package( opencv required ) and set(cmake_module_path ${cmake_module_path} "/usr/local/cellar/opencv3/3.0.0/share/") find_package( opencv required ) but in cmakecache.txt still see this: opencv_config_path:filepath=/usr/local/share/opencv which again not need.. thank you. there couple of options. option 1 use: cmake_prefix

ios simulator - Are Apple's simulated iOS devices' Safari apps exactly the same as real devices for testing offline storage? -

i want test offline web app , using html5 storage, in particular testing: application cache websql localstorage do simulators have same limits , implementations safari on real ios device? for example, code work same in giving user prompts , limits on real ipad? db.transaction(function ontransaction(t) { t.executesql('insert entries (name, size, date, payload) values(?, ?, ?, ?)', data, function onexecutesqlcallback(t, results) { ... }, function onexecutesqlerror(t, e) { // returning true rollback, false continue transaction; return false; }); }, function ontransactionerror(sqlerror) { //over quota if (sqlerror.code === sqlerror.quota_err) { ... } }, function ontransactionsuccess() { ... });

java - GCM device to device messaging - how is it done? -

i'm interested in how apps whatsapp implement feature. i've read it's bad practice send message directly device device, because can api key , send messages application. what's solution then? having server , making devices communicate server, when want send message device, goes server , server target device? also question: public void onmessagereceived(string from, bundle data) this method of gcmlistenerservice. when "from" different default senderid? because tried sending message directly 1 device , "from" still default senderid got when registered app on website. basically, need server listen upstream messages , broadcast again intended recipients. you can find article describing here: http://javapapers.com/android/android-chat-with-google-gcm-xmpp/ the approach pretty limited , not flexible having own messaging server, should enough proof of concept.

c++ - Print on the screen the symbol \ as text -

this question has answer here: using \ in string literal instead of escape 2 answers i want following printout appear in screen when run code: \begin{tabular} \hline \\ for that, using following command on code: std::cout<<"\begin{tabular}<< std::endl; std::cout<<"\hline \\"<< std::endl; and i'm getting following compiler message (regarding second line of code): unknown escape sequence: '\h' and following incomplete printout: egin{tabular} hline\ where in first 1 "\b" missing , first , last \ missing second sentence. the question is: know how can print \ symbol text, such printed , not interpreted command, etc? the backslash forms escape sequences in c++. have 2 options: double backslashes, la "\\hline \\\\" (the backslash escape itself, in tex). use c++11 raw

templates - D: Creating an array of templated objects -

i'm trying create array of regex objects, so: regex[] regexes; . compilation fails main.d(46): error: template std.regex.regex(char) used type . i find documentation cryptic. understand templates generate code on compilation, don't see what's preventing me creating array of regex . there's existing question on stackoverflow same problem, deals c++, not d. you cannot create regex object without first instantiating template type. because actual type generated @ compile time based on instantiation type give. regex not actual type, template function allowing generate type when instantiated. in case want change: regex[] regexes; into: regex!char[] regexes; to tell compiler regex contains chars opposed derived type. means instantiating regex template type char.

Where is the option to "get everything" when opening a solution in Visual Studio 2015? -

Image
in previous versions of visual studio there option "get when solution or project opened" in visual studio 2013 first option in source control environment settings: does option exist in visual studio 2015? if not, there way automatically latest version when opening solution? the feature removed last minute had major negative impact on dynamic solution loading process speeds opening large solutions in visual studio 2015. quote from product group here : late in ship cycle, found async project load improvements caused large issue feature. namely, if had feature enabled, see vs deadlock if tried sources while asynchronously loading projects. given feature is, in general, bad practice, , fixing have been significant investment, decided remove it. if need alternative, it's better create little batch script or powershell script uses tf commandline latest version before opening solution: tf . /recursive /version:t start solutionfile.sln that way s

parsing - How does Swift disambiguate generic constructors? -

consider following swift expression println(generic<foo, bar>(1)) normally, 1 read generic call constructor generic<foo, bar> arguments (1) . println( generic<foo,bar>(1) ) however, when re-arranging tokens bit, represent 2 separate comparisons, example if generic , foo poorly named numeric variables: println(generic < foo, bar > (1)) // or, proper parenthesis println((generic < foo), (bar > 1)) what can observe here expression generic constructor highly ambiguous, , not easy disambiguate humans. problem here swift doesn't have new keyword constructors, makes them ambiguous method calls , operators in cases. thus, interested in how swift compiler (parser) manages disambiguate above expressions. way parsed dependant on context (types, variables, functions) or can resolved parser? the answer simple: compiler does't allow declare these variables: struct generic<t, u> { init(_ i: int) {} } struct foo {} struct

How to change button image at mouse hover over in tkinter in Python? -

i've started adventure python recently, please go easy on me :d i've been working on 2nd program gui in tkinter couple of days now, , looks i've run wall. it's game creates 2d map making 2d list. each element of list created button tkinter object instance tile_basic_off image. far good. should try bind each of these buttons 2 functions mouse over/mouse leave things go south... it should work like: mouse on -> change image tile_basic_on mouse leave -> change tile_basic_off however, once code below run (there function draws .grid() method) same, tiles not changing image @ mouse on or mouse leave. here question-wise important piece of code. (note redmagenta var holding rgb, not typo) from tkinter import * #python 3.4 here def createmap (): #creates rows x columns 2d list - map global rowsentryvar, columnsentryvar, maplist maplist = [] row in range(rowsentryvar): templist = [] column in range(columnsentryvar):

java - Location of AntiSamy policy file in web project -

i'm trying use antisamy prevent xss attacks on site. downloaded following jars , added them "/web-inf/lib" antisamy-1.5.3.jar nekohtml.jar xercesimpl-2.5.0.jar along policy file antisamy-slashdot-1.4.4.xml in "/web-inf". i tried implement filter through web.xml . snippet of servlet i'm using is public class antisamyfilter implements filter { private static final logger log = logger.getlogger(antisamyfilter.class); private final antisamy antisamy; public antisamyfilter() { try { url url = this.getclass().getclassloader().getresource("antisamy-slashdot-1.4.4.xml"); log.info("after getresource"); policy policy = policy.getinstance(url.getfile()); //deployment fails log.info("after policy"); antisamy = new antisamy(policy); log.info("after antisamy"); } catch (policyexception e) { throw new illegalstateexception(e.getmessage(), e); } }

r - Making fitdist plots with ggplot2 -

Image
i fitted normal distribution fitdist function fitdistrplus package. using denscomp , qqcomp , cdfcomp , ppcomp can plot histogram against fitted density functions , theoretical quantiles against empirical ones , the empirical cumulative distribution against fitted distribution functions , , theoretical probabilities against empirical ones respectively given below. set.seed(12345) df <- rnorm(n=10, mean = 0, sd =1) library(fitdistrplus) fm1 <-fitdist(data = df, distr = "norm") summary(fm1) denscomp(ft = fm1, legendtext = "normal") qqcomp(ft = fm1, legendtext = "normal") cdfcomp(ft = fm1, legendtext = "normal") ppcomp(ft = fm1, legendtext = "normal") i'm keenly interested make these fitdist plots ggplot2 . mwe below: qplot(df, geom = 'blank') + geom_line(aes(y = ..density.., colour = 'empirical'), stat = 'density') + geom_histogram(aes(y = ..density..), fill = 'gra

animation - Importing tweenMax into javascript -

im trying import tweenmax html, cant find im doing wrong... i´ve done in website. <!doctype html> <html> <head lang="en"> <link rel="stylesheet" href="css/paginafinal.css"> <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.17.0/tweenmax.min.js"></script> <meta charset="utf-8"> <title></title> </head> here im make init; <body onload="init()" onclick="pointerdefault(event)"> <input type="text" id="search" name="procurarpalavra" onkeypress="premirenter(event)"> <img src="search.png" alt="smiley face" id="ok" onclick="enviarpalavra(event)" > <img src="info.png" id="help"> <footer id="myfooter"> </footer> the script goes here function init() { var sea

google app engine - Getting *http.Request from Context on AppEngine -

i'm using app engine, , creating context.context (golang.org/x/net/context) variable *http.request . c := appengine.newcontext(r) i'm passing context around , i'm trying figure out way *http.request context.context in order log http.request . i search on doc couldn't find solution. appengine.newcontext(r) returns value of type appengine.context . not same context type of golang.org/x/net/context package! having value of type appengine.context , can't *http.request used create it. if need *http.request , have take care of passing around (you have it, since use create context). note appengine.context (which interface type) has method context.request() , internal use only, not exported call it. , returns interface{} , not *http.request . if returns value holding *http.request , can't rely on method may changed or removed in future versions. passing *http.request along appengine.context is best way. trying context "wizar

c++ - what class type should s be in after s has been resolve by for(auto &s :text)? -

string text("asdffffffffff.f"); (const auto &s : text){ cout << s ; if(s.empty() || s[s.size()-1] == '.') cout << endl; else cout << "" ; } return 0; }; my book doesn't state text should be, made string text up, type should text be? const string, const char, else? after resolve, type s becomes? what s[s.size()-1] ? or function type s attempting call both empty , size? -after compiling error: 'empty , size in 's,' of non-class type 'const char. when though string , char function in book, couldn't find empty() or size() function. have make function empty() , size()? in case auto deducted type char, s const char& . to fix code can write : (const auto& s : text){ cout << s ; if(s == '\0' || s == '.') cout << endl; else cout << "" ; } '\0' represents empty char. don't hav

android - Increment push notification number -

i use parse.com android app's backend. send push notifications users using parse cloud code. when send multiple pushes user, gets multiple push notifications, how increment number in notification in phone rather making multiple notifications appear? when publish notification, specify id, (the number 123 in example): intent notificationintent = new intent(mactivity, notificationpublisher.class); notificationintent.putextra(notificationpublisher.notification_id, 123); if want send new notification, , replace one, make sure set same id when send new notification (which replace existing notification new content)

javascript - Keep a list with img on a same line -

Image
i know how place different li or div img inside centered on same line. here picture of want have: here did far: as see li displayed vertically want display li horizontally. what i've tried is: can if use position absolute li , display each 1 @ different % left:100% left first one, 200% second one,... is solution? if want dynamically change image via javascript maybe it's more easy keep position:relative . and here code. html: <div id="pagegallerie"> <div id="carre1" class="carre"></div> <div id="carre2" class="carre"></div> <div class="gallerie"> <li class="pictures" id="yo1"><img src="img/intro1.jpg" alt="smiley face"></li> <li class="pictures" id="yo2"><img src="img/intro2.jpg" alt="smiley face"></li> <li clas

c++ - The performance of multidimensional arrays and arrays of arrays -

i have thought , known multidimensional arrays indexing done once multiplication faster arrays of arrays indexing done 2 pointer dereferencing, due better locality , space saving. i ran small test while ago, , result quite surprising. @ least callgrind profiler reported same function using array of arrays run faster. i wonder whether should change definition of matrix class use array of arrays internally. class used virtually everywhere in simulation engine (? not sure how call..), , want find best way save few seconds. test_matrix has cost of 350 200 020 , test_array_array has cost of 325 200 016 . code compiled -o3 clang++ . member functions inlined according profiler. #include <iostream> #include <memory> template<class t> class basicarray : public std::unique_ptr<t[]> { public: basicarray() = default; basicarray(std::size_t); }; template<class t> basicarray<t>::basicarray(std::size_t size) : std::unique_ptr<t[]>(ne

php - Search the database using 4 different select boxes -

i have rather complex "where" statement create. have searched many sites find answers , yet page still shows nothing. business requirement: use 4 different drop downs results database either selecting one, all, or combination of four. here php code file searchinstructors.php: <?php $dsn = 'mysql: host=localhost; dbname=name'; $user = 'user'; $password = 'pass'; try { $pdo = new pdo($dsn, $user, $password); $pdo ->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch (pdoexception $e) { echo 'connection failed: ' . $e->getmessage(); } if(isset($_get['semester'])){ $semester = $_get['semester']; }else{ $semester = "not selected"; } if(isset($_get['year'])){ $year = $_get['year']; }else{ $year = &

java - Is it possible to import an excel file to smartsheet API? -

are there functions or methods in smartsheet api 1.1 allow create new sheet or update existing sheet based on csv or xml file? at time smartsheet api not have method import csv or xml file. however, can import csv in smartsheet application. more info here also, can use java library read csv or xml file , issue appropriate api calls create new sheet , insert rows. can done more efficiently using 2.0 version of smartsheet api .

jquery - Is there a way to add a highlight color to the thumb border on lightslider? -

looking add border color thumb images..... add the css or add style section in html code? <script src="js/jquery-1.8.0.min.js"></script> <script src="js/lightslider.js"></script> <script> $(document).ready(function() { $("#content-slider").lightslider({ loop:true, keypress:true }); $('#image-gallery').lightslider({ gallery:true, item:1, thumbitem:9, slidemargin: 0, speed:700, auto:true, loop:true, pause: 5500, bordercolor: #222222 <------------------- ??? onsliderload: function() { $('#image-gallery').removeclass('cs-hidden'); } }); }); </script> unfortunately, lightslider doesn't provide option style border color of images. therefore cannot use bordercolor in

.net - How to activate the insertion of ByVal keyword by default in Visual Studio 2015? -

in visual studio 2015 , option should enable/disable activate auto-generation of byval keyword vb.net ? i've tried toggle " pretty listing (reformatting) of code " option, not take effect. maybe there alternative solution via 3rd party extension visual studio ? this behaviour changed in visual studio 2010 service pack 1. carlos quintero writes in blog : "i e-mailed program managers changed behavior, in turn introduced me developer, , confirmed there no setting (and no plans) old behavior in vb.net code editor." so, possible way behaviour seems to install visual studio 2010 , no service packs. might not reasonable solution most... the main reason byval keyword added automatically in first place seems default way of passing parameters in vb 6 byref . default supposedly had change vb make reasonable transition .net, confuse vb 6 programmers, ide automatically made specific. nowadays there no longer need make specific avoid con

ios - why is PHPhotoLibrary performChanges creationRequestForAssetFromVideoAtFileURL so slow? -

i'm measuring times tens of seconds minutes depending on size of video. shouldn't change request fast (local flash disk copy/meta data/checksums) adds local video photolibrary/camera roll? this issue appears occur when icloud backups turned on. haven't been able find helpful information through web search or apple dev docs. sample code: func exportassettophotolibrary(videourl: nsurl, _ exportedasset: (localidentifier: string) -> void) { var localidentifier = "" var starttime = nsdate.timeintervalsincereferencedate() phphotolibrary.sharedphotolibrary().performchanges({ let assetrequest = phassetchangerequest.creationrequestforassetfromvideoatfileurl(videourl) let assetplaceholder = assetrequest.placeholderforcreatedasset localidentifier = assetplaceholder.localidentifier }, completionhandler: { success, error in var elapsedtime: nstimeinterval = nsdate.timein

Linux Set User and Group Ownership for Future Files and Folders -

i changing user , group ownership using following command: sudo chown -r apache:www /var/www however, noticed whenever added new file or folder directory, owner current username instead of intended user, apache. how can modify above command future folders , files owned apache:www? or need use command? my guess need change user before executing command - script this: $whoami user1 $ su - apache password: $ whoami apache [add file] $ exit

mysql - Why does UPDATE x SET y='c' AND TRUE result in y='0' -

i'm playing around sql challenge , noticed given table x single text column y following query: update x set y='c' , true results in y='0' also: update x set y='c' or true results in y='1' out of curiosity i'm trying understand what's happening underneath produce these results. expressions y='c' , true , y='c' or true boolean expressions . evaluate either 1 when expression true, or 0 , when expression false. your update evaluates these expressions, , stores results in field y .

recursion - How can I copy an entire directory in Perl, without using File::Copy::Recursive? -

question: my question pretty identical this 1 here except cannot use file::copy::recursive. constraints: i cannot install or modify existing environment, stuck using works. use file::copy; # works! use file::copy::recursive # doesn't work :( use file::path # works! i error: ( i cannot fix error, since user of system, not admin or anything ) can't locate file/copy/recursive.pm in @inc (@inc contains: /path/to/some/place /path/to/other/place .) @ my_program.pl line 13. scenario: if helps, scenario want copy contents directory, lets ~/my_dir onto exists here ~/ . ~/my_dir has sub-folder ~/my_dir/sub_dir , want copy directory , of it's contents too. the system's tools way better @ anyway. system('cp', '-rp', '--', $src, $dst); die("can't launch cp: $!\n") if $? == -1; die("cp killed signal ".($? & 0x7f)."\n") if $? & 0x7f; die("cp exited error ".($? >> 8)

bash - How to open emacs in new window after using ssh login -

when open terminal , type "emacs", new emacs window opens. after using ssh log in host, typing "emacs" creates emacs buffer inside terminal. is there way can specify when using ssh want windows opened outside of terminal? perhaps inserting .bashrc? note: tried using "ssh -y" instead of "ssh". didn't work. edit: don't know why didn't work before, both "ssh -y" , "ssh -x" solve problem. if emacs not compiled use windowing system, not able this. c-u m-x emacs-version output? typically (certainly recent versions of emacs) indicate presence of x support. if it's been compiled x, 1 of -x or -y ssh arguments (taking appropriate note of warnings) indeed how done, you'd presumably have dig little figure out might going awry. (failing that, can of course use local gui emacs access remote files on ssh via tramp.)

shiny - Making D3.js request JSON data to server.R and passing back data -

i trying front-end ui built d3 talk server.r , json file read instead of static csv done , working. just can't find way it. currently, d3 portion of code reads csv (and works) looks this: queue() .defer(d3.json, "us.json") .defer(d3.csv, "aggregatekeystonestates.csv", function(d) { dollarbyid.set(d.id, +d.dollar); textbyid.set(d.id, d.tooltiptext); }) .await(ready); simply want pick json object instead server.r through input/output paradigm. sorry, new stuff.

javascript - How to change html shorthand to html tag when adding content dynamically -

var encodedhtml = "&lt;ol style=&quot;color: rgb(34, 34, 34); font-family: arial, sans-serif;&quot;&gt;&lt;li class=&quot;mod&quot; style=&quot;&quot;&gt; &lt;div class=&quot;_odd&quot; style=&quot;&quot;&gt;&lt;span class=&quot;_tgc&quot; style=&quot;font-size: 16px;&quot;&gt;&lt;b&gt;test data&lt;/b&gt; &lt;b&gt;data&lt;/b&gt; which has been identified use in &lt;b&gt;tests&lt;/b&gt; , typically of computer program. &lt;b&gt;data&lt;/b&gt; may used in confirmatory way, typically verify given set of input given function produces expected result. &lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;/ol&gt;"; i want change content html tags , can add div using js. this should sorted out: what's right way decode string has special html entities in it? a few answers down has jquery

eclipse plugin - Table Viewer length Increases automatically under Section -

i newbie swt , layouts. have composite inside have section called "table contens" inside have composite "composite b" inside using table viewer uses tablecolumnlayout . all composite , sections uses grid layout , griddata griddata = new griddata(griddata.fill, griddata.fill, true, false); my problem is,first time table contains 5 rows, table size arranges accordingly.if select file populated 10 rows , comes scrollable. when go tab , come table viewer tab refreshes layout , height of viewer adjust 10 rows. if give height , width manually working griddata objectivesectiondata=new griddata(670,150); but want table resize based on screen need restrict height of it. i know need layout .but dont know how it? in need of much.any advice ? thanks in advance specify griddata heighthint value, like: griddata griddata = new griddata(griddata.fill, griddata.fill, true, false); griddata.heighthint = 150;

java - Use different jre for projects and for eclipse launch -

may newbie question... i want use latest eclipse available. requires java 8. however, our company uses java 6 projects. so: should download eclipse compatible java 6 ? or can configure java 6 projects regardless eclipse uses? would there issues, if possible use 2 versions (one eclipse , 1 project)? i know newbie questions. search did not yield proper response. no, can use latest java eclipse. jdk used project can configured per project or per workspace. can install jdks desire. i.e. can start eclipse using 32bit jdk while using 64bit jdk java ee-servers or projects, has nothing jre used eclipse. need set up.

Snap.svg hiding and showing objects from different layers of existing svg file -

i have defined variable 'circle' on hidden layer of svg. know how show , hide again. edit: aright, i'm sorry wasn't specific. i'm beginner :) have .svg file 2 circles - black , grey. i'd black button appear when grey 1 hovered. point is, circles on different layers , manage visibility inkscape(hide elements on given layer). here's fragment code of svg file contains inkscape meta "grey" layer: <g inkscape:label="grey" inkscape:groupmode="layer" id="layer1" transform="translate(-8.571418,-6.6478954)"> <path sodipodi:type="arc" style="fill:#a4a4a4;fill-opacity:1;fill-rule:nonzero;stroke:none" id="grey" sodipodi:cx="180" sodipodi:cy="289.50504" sodipodi:rx="90" sodipodi:ry="90" d="m 270,289.50504 c 0,49.70562 -40.29437,90 -90,90 -49.70563,0 -90,-40.29438 -90,-90 0,-49.70563 40.29437,-90 90,-90 4

javascript - How to fix a particular error for a Firefox Addon -

right when try update firefox addon submitting firefox marketplace speak, gives me following error: missing jetpack module warning: jetpack module listed in harness-options.json not found in add-on. path: resources/cashbackjournal/lib/handlers.js.js harness-options.json my question is, how fix this?

fortran - Adding large numbers returns strange, large numbers -

i trying calculations in fortran looks like: large number (order e40) - large number (order e40) i should zero. of time works, in couple of cases i'm getting weird numbers. 1 answer fortran gave me -1e20 . weird answer got 32768 , 2^15 , oddly enough. does have clue why happening? it's hard tell without actual code, but... this expected if numbers sufficiently similar. while 1e20 pretty large compared 1 or 2 , pretty small compared 1e40 . in fact, double precision, have 15-17 digits of precision . considering that, values below accuracy possible numbers in range of 1e40 . what see numerical noise. [ possibility, of course, trying in single precision. not possible (max. exponent ~38) , might happen. ]

r - How to separate date and time -

Image
i`m giving input "a <- [12/dec/2014:05:45:10]" not time-stamp cannot use time , date functions now want above variable split down 2 parts as:- date --> 12/dec/2014 time --> 05:45:10 any appreciated. you can use gsub create space between date , time , use create 2 columns read.table read.table(text=gsub('^\\[([^:]+):(.*)+\\]', '\\1 \\2', a), sep="", col.names=c('date', 'time')) # date time # 1 12/dec/2014 05:45:10 or can use lubridate convert 'posixct' class library(lubridate) a1 <- dmy_hms(a) a1 #[1] "2014-12-12 05:45:10 utc" if need 2 columns specified format d1 <- data.frame(date= format(a1, '%d/%m/%y'), time=format(a1, '%h:%m:%s')) data <- "[12/dec/2014:05:45:10]"

c++ - Circular dependency -

i have class called point , other namespace containing tree class. tree balanced binary search tree, , uses function compare compare keys , puts them in right place. tree contains point s, , each point have know tree belongs to, tried add pointer tree in point class this: class point{ public: double x, y; std::set<std::multiset<point,tree::compare()>*>s; //tree name of namespace // other data } my problem since tree uses point.h (because stores point s) cant add layerthree.h cant use tree::compare() in point.h . tried add new file cmp.h , put compare function in it, did not help. should do? edit: can not put both tree , point class in same file because there other files needs include point.h as jepessen mentioned need forward declaration. here example: class depends on class b , class b depends on class a, use forward declaration this: in class "b.h": #include "a.h" class b { //do stuff }; and in class &qu

jquery - Why are there no mousewheel events fired in Edge when using a Surface Pro 3 Type Cover -

i'm not getting mousewheel events in microsoft edge when scrolling overflown div surface pro 3 type cover. edge bug? demo: http://jsfiddle.net/achqzgll/10/ $(document).ready(function(){ $("#scroll").on("mousewheel wheel", function(){ alert("scroll"); }); });

android - How to programmatically install an APK from a Service -

intent intent = new intent(intent.action_view); intent.setdataandtype(uri.fromfile(new file(environment.getexternalstoragedirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive"); startactivity(intent); this found here: question [4967669] android-install-apk-programmatically using android service if following error message: 05-03 08:24:14.559: e/androidruntime(21288): fatal exception: thread-1706 05-03 08:24:14.559: e/androidruntime(21288): android.util.androidruntimeexception: calling startactivity() outside of activity context requires flag_activity_new_task flag. want? i added flag_activity_new_task: intent.addflags(intent.flag_activity_new_task); but nothing happens. no error no attempt install apk. thinking might because has no activity (since service)? question possible install apk via android background service? (if so) 1 knwo how do it? thanks in advance ps: understanding of service

php - SQL Injection to statements -

this question has answer here: how can prevent sql injection in php? 28 answers by setting page, "register" users mysql database, , using following code: $name = $_post['name']; $saltedpwd = md5($definedsalt.$_post['pwd']); $email = $_post['email']; $query = "insert `users` ( `name`, `pwd`, `email` ) values ( '$name', '$saltedpwd', '$email' )"; $insert = mysqli_query($database, $query); is vulnerable possible sql injections? about email activation code, using code: $address = $_get['email']; if (isset($_get['val']) && (strlen($_get['val']) == 64)) { $validate = $_get['val']; } if (isset($address) && isset($validate)) { $query = "update users set activated = 'true' ( email ='$address' , validate='$val' ) limit 1&qu

Google Developer Console's credential side permission -

Image
i got problem after create , apis on google developer console , enable gcm service, want add server key @ credential next apis on left hand menu. show me you not have sufficient permissions view page. below image: is config need add? did follow you not have sufficient permissions view page clear cache , use incognito mode login, still not work. edit time relogin work back, when click side , click show error again, , solution go credential use top right corner account logout , relogin , let redirect credential , work. there solution fixed permanently without relogin? thanks it because of have logged in multiple devices. u have log out devices. go gmail.com , log in using email , password. , scroll down . can see details link . click link. it open new window. there u click sign out other web sessions. clear history. login , try . open without showing error.

multithreading - How to add multi-threading/multi-client feature to a very simple scala server program? -

scala newbie here, i'm deliberately using older version of scala 2.7.5 this compatibilites older libraries need use along server code val server = new serversocket(9999) println("server initialized:") val client = server.accept /* initalize big service here -> takes >10 seconds */ while(true){ val in = new bufferedreader(new inputstreamreader(client.getinputstream)).readline val out = new printstream(client.getoutputstream) println("server received:" + in) out.println("message received") out.flush } basically, works single client. won't connect client because running inside while loop i need modify code process requests multiple clients therefore, possible me without writing multithreaded program? if not, can me out code snippet add basic threading program? you'll want use nio channels in non-blocking mode - let multiplex several input streams using single thread. this tutorial in nio socketcha

pandas - Transposing data in dataframe with multiple rows per ID -

i have dataframe 2 columns: id , value. each id appears in many rows unique values. there 2 values i'm interested in logging, 2 & 39. instead of having 1 row per value i'd create new dataframe 3 columns: id, value2, value39. value2 , value39 need boolean values indicate whether or not registered in original dataframe. thanks help. edit: i'd have dataframe 1 row per id. means need consolidate value2 , value39 boolean value 1 row. create second dataframe based on id column on first dataframe, , create 2 columns testing whether or not value 2 or 39. df = pd.dataframe({'id': {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 6, 6: 6}, 'value': {0: 2, 1: 2, 2: 39, 3: 39, 4: 1, 5: 39, 6: 2}}) df2 = df[['id']] df2['value2'] = df.value == 2 df2['value39'] = df.value == 39 edit: >>> df2.groupby(['id']).any() value2 value39 id 0 true false 1 true false 2 false true

cordova - Application Insights initialization by code in Windows Phone fails -

we trying application insights in our apps work. if choose automatic configuration "add application insights telemetry" works, if try add following code, not: telemetryconfiguration.active.instrumentationkey = instrumentationkey; telemetryclient tc = new telemetryclient(); tc.trackevent("testevent windows phone"); there no exceptions or error messages thrown, not show events in visual studio window or azure portal. what wrong code? adding of instrumentation key? found here . need add instrumentation key , initialization complete dynamically, because need use in 1 of our cordova applications plugin (which working android). thanks help. please follow documentation: https://azure.microsoft.com/en-us/documentation/articles/app-insights-windows-get-started/ in short: 1. add applicationinsight.config instrumentation key. 2. add line windowsappinitializer.initializeasync(); first line in app constructor. 3. create telemetr

php - How should I return an error (and a message) in large project? -

i'm writing large project, , here's class i'll use often: class star { /** * add * * add star something. * * @param int $id id of thing. */ function add($id) { if($this->starred($id)) return 'you starred already.'; if(!$this->existing($id)) return 'the 1 tried star no longer exist.'; $this->db->star($id); return 'starred successfully!'; } } $star = new star(); but use in different ways like: single page or inside function , here's problem, sometimes, want know return code not message , but when use in single page, want return messaage, so if change add() function this: function add($id) { if($this->starred($id)) return 0; if(!$this->existing($id)) return 1; $this->db->star($id); return 2; } i can use in functions handle error: /** leaves comment */ $comment-&g