Posts

Showing posts from February, 2010

javascript - Pass object by reference to a returned function -

validations = [] isempty = (string) -> string '' or string undefined or string == null createvalidation = (scopevariable, expected, responsetext, inverse) -> if inverse == undefined inverse = false if !inverse returningvalidation = -> if scopevariable isnt expected $scope.response.text = responsetext $scope.response.class = 'text-danger' return false true else returningvalidation = -> if scopevariable expected $scope.response.text = responsetext $scope.response.class = 'text-danger' return false true returningvalidation validatecredentials = -> validated = true validations.map (validate) -> if !validate() validated = false validated $scope.register = -> if validatecredentials() #account.register $scope.f...

php - Remove from multidimensional array if value partially matches -

i write multilingual wordpress homepage. need load languages array, detect user language , depending on user language remove other languages array. i want partial check on array see if "title" contains _de or _es , depending on result remove 1 or other array. so far have data array(2) { [1]=> array(3) { ["order"]=> string(1) "1" ["title"]=> string(9) "slider_es" ["id"]=> string(3) "500" } [2]=> array(3) { ["order"]=> string(1) "2" ["title"]=> string(11) "slider_de" ["id"]=> string(3) "493" } } logic $current_language = get_locale(); // wordpress function returns either es_es or de_de codes if ($current_language == es-es) { foreach ($array $key => $item) { if ($item['title'] === '_de') { unset($array[$key]); } } } else { foreach ($array $key => $ite...

Program execution in java -

i trying open exe file, specificly indrirunquery.exe 1 of tools offers lemur indri package. when use command prompt write following command: indrirunquery queries.txt with this, editting of queries included in queries.txt (which passed parameter in above command) starting. then after descent amount of time has passed ,i write following in order save results produced in file named results.txt: indrirunquery queries.txt >results.txt my problem every time want edit file contains queries need same steps. have 20 different query files edit. trying find way using java program can not figure out. i have used these lines of code doesnot work @ all. can me out this? processbuilder builder = new processbuilder("c:\\program files\\indri\\indri 5.8\\bin\\indrirunquery.exe", "c:\\users\\Πετρής\\desktop\\titlesrel.txt"); builder.start(); processbuilder builder2 = new processbuilder("c:\\program files\\indri\\indri 5.8\\bin\\indriru...

sql - JOIN table with itself, and filter rows from each table with bitwise operation -

i have following table, -- generated pg_dump, constraints missing create table articulos_factura_venta ( fila integer not null, cantidad integer not null, color integer not null, talla integer not null, estado integer default 2 not null, origen integer, factura integer not null, articulo integer not null, precio integer not null, vendedor integer, anulado boolean default false, iva double precision default 12.0, fecha date default ('now'::text)::date not null ); and contains following rows 1 fila | cantidad | color | talla | estado | origen | factura | articulo | precio | vendedor | anulado | iva | fecha ------+----------+-------+-------+--------+--------+---------+----------+--------+----------+---------+-----+------------ 0 | 1 | 0 | 3 | 6 | 18 | 28239 | 1325 | 455 | 6 | f | 0 | 2015-04-22 1 | 1 | 0 | 2 | 6 | 93 | 28239 | 2...

java - Missing images when using a servlet and Jetty -

i have created small maven project, using servlets , jetty. servlet works fine , outputs html page. however, linked image not displayed (missing). this small piece of code setup server ... // set handler 1 (display html) servletcontexthandler context = new servletcontexthandler(servletcontexthandler.sessions); context.setcontextpath("/"); context.addservlet(new servletholder(hws),"/hello"); // set handler 2 (for images) webappcontext wac = new webappcontext(); wac.setcontextpath("/img"); // attach handlers server handlerlist.sethandlers(new handler[]{context,wac}); myserver.sethandler(handlerlist); a piece of servlet ouputs html ... printwriter out = response.getwriter(); response.setcontenttype( "text/html"); out.println( "<html><head><title>hellow world</title></head>"); out.println( "<body><h1>hello world</h1>...

java - Better way to extract files from apk -

i've used this method extracting java , xml files apk file java files have lot of modifications sure wasn't there in original code. for example, in 1 class appears several times access$902 , access$902 ,string of digits 2130903064 . appear in place of other methods or variables , project doesn't build because of them. can there extracted original files or solution problem? thanks no. because build process generate .class files, , reverse engineering nevers original code (afaik). if .apk file generated using proguard , less readable , more difficult understand. the best alternative use androchef java decompiler, runs in windows. tool can allow change method / variable / class names more readable, including generated files. the original code developer / company owns. hope not using illegal.

html - How to avoid one DIV overflowing the other? -

hello have following code ( jsfiddle ) #statements { position: relative; top: 0; bottom: 0; height: 100vh; background-color: rgba(200, 200, 200, 0.4); max-width: 340px; padding-left: 50px; z-index: 1; } #entries { position: relative; height: 60%; max-width: inherit; overflow: scroll; } #entryform { position: fixed; height: 300px; bottom: 0; background-color: rgba(200, 200, 200, 0.8); width: 340px; } and <div id="statements"> <div id="entries">entry</div> <div id="entryform">entryform</div> </div> my problem cannot make entries stop before entryform starts (also should responsive browser height). any idea how make entries not overflow entryform div? thanks! entryform has position:fixed... means removed 'flow' of document. causes entries not effect entryform . to entryform below of entries, add height: 40% entryform .

node.js - Node-Redis psubscribe with custom messages -

i under impression using library: https://github.com/mranney/node_redis could this: var redis = require('redis'); var pub = redis.createclient(); var sub = redis.createclient(); sub.psubscribe('channel'); sub.on('message channel', function(){}); pub.publish('channel','a message xyz'); the problem can't seem sub.on() receive specific custom message. entry point seems fired sub.on('message') or sub.on('pmessage') , how can sub.on('my custom message') invoked? hope makes sense. this how node redis client works. reserves message , pmessage emit events notifying of subscribe , psubscribe events respectively. https://github.com/mranney/node_redis#publish--subscribe but if want syntax have in code can define own message format , eventemitter , maybe: var events = require('events'); var redis = require('redis'); var pub = redis.createclient(); var sub = redis.createclient();...

sas - LAG function doesn't complete -

i constructing life table. data looks this: age npx ================= 0-1 0.996 1-4 0.9955 5-9 0.9966 i want construct new variable lx . value of lx age="0-1" 100,000 . value "1-4" lx * npx previous record. here's code: if age = "0-1" lx = 100000; lag_lx = lag1 (lx); lag_npx = lag1 (npx); lx = lag_lx * lag_npx; what happens program stops calculating lx after 2nd record; record 3 on, lx has . (missing) i go down ifn route here doesn't screw think lagged value , makes code simple (have read of this paper ). need retain statement stated @alex a. data have; input age $ npx; datalines; 0-1 0.996 1-4 0.9955 5-9 0.9966 ; data want; set have; retain lx; lx = ifn(age='0-1',100000,lx*lag(npx)); run;

java - Ebean record fails to pick up on a relationship -

i having trouble ebean/play not picking licks between tables. i have 3 tables, users , groups , usersgroups (bridge). i have record in each table , when pick users record, object has access associated usersgroups records. when try same groups linked usersgroups object empty. have little experience orms , have no idea how can debug issue. users class: @entity public class users extends model { @id @generatedvalue(strategy = generationtype.auto) public long intuserid; @javax.persistence.column(length = 50, unique = true) @constraints.required public string strusername; @onetomany(mappedby = "user", fetch = fetchtype.eager, cascade = cascadetype.all) public list<sessions> session; @onetomany(mappedby = "member", cascade = cascadetype.all) public list<usersgroups> memberofgroups; @javax.persistence.column(length = 50) public string strfirstname; @javax.persistence.column(length = ...

android - Tracking of registered mobile users/associates who are in defined radius of distance -

i have registered users on mobile can tracked on maps, once have mobile active apps. want track users available in close proximity of 1 km (which can defined). of now, result of registered users irrespective of distance. can how track users within radius of choice , users coming radius. thanks you can users' location (longitude , latitude). calculate users distance between each other on setting time. ( track distance , time based on track details ) then know coming else radius.

arduino - Booting programs from an Intel Edison board -

i bought intel edison breakout board kit grove starter kit plus want write program gives board ip address, checks temperature in room , if temperature exceeded turns led on. can check what's going on rgb display. when connect usb otg port laptop wifi connection detected, ip address received , temperature control works fine. program works ask for. questions. execute same program unplugging usb connection, make board independent pc, if standing alone device 1) if upload working program in board, unplugging usb , of course giving power supply through jack on breakout board not work anymore , stops on message "preparing network connection...". intel edison has integrated wifi module , can't understand why not able establish internet connection anymore without of usb connection laptop. what's wrong it? how boot , execute program power supply? setup function() of program, don't reach loop() 1 not post it void setup() { // ------ lcd in action ------ // ...

ruby - Comparing values of 2 columns from 2 tables and counting the total matches in rails -

i have 2 tables in rails application 1 of them products , other users . in products table have created_by_id integer matches id of user created it. need display running total of products , having issue doing so. class applicationcontroller < actioncontroller::base protect_from_forgery with: :exception def ensure_logged_in unless current_user flash[:alert] = "please log in" redirect_to root_path end end def totalprods product.all.joins(:users).where("created_by_id current_user.id").count end helper_method :current_user private def current_user @current_user ||= user.find(session[:user_id]) if session[:user_id] end end i'm new rails sorry if screwing up in app/models/user.rb file, add: has_many :products, foreign_key: 'created_by_id' then can use: current_user.products.count ps: it's idea call column user_id instead of created_by_id since rails can guess association...

android - How to code Relative layout in java, instead of xml? -

i want run app using java code instead of xml files. app not working on phone/emulator , crashing every time. the code looks this: package com.nikhil.relativelayoutjavacode; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.button; import android.widget.edittext; import android.widget.relativelayout; import android.widget.relativelayout.layoutparams; import android.widget.textview; public class mainactivity extends actionbaractivity { relativelayout main; edittext usernamevalue, passwordvalue; textview message, username, password; layoutparams messagedimensions; button login; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); init(); createmessagetextview(); main.addview(message, messagedimensions); setcontent...

arrays - Changing Filenames(Strings) through loops - Java -

i want change images @ specific location, purpose of animation. can create loop change in file names. file names sprite1.png, sprite2.png ...... sprite10.png. for(i = 1; <= 10; i++) { display("sprite(i).png") } is possible? how? lets there n files. can achieve desired output using following piece of code for(i=1;i<=n;i++){ display("sprite"+i+".png") }

C++ multilevel inheritance function calls -

consider multilevel inheritance between c++ classes. consider: struct { void dummy1() { } }; struct b : { void dummy1() { } }; struct c : b { void dummy() { dummy1(); } void dummy1() { } }; struct d : c { void dummy1() { } }; struct e : d { void dummy1() { } }; given: e e; e.dummy(); i want know dummy1 called. 1 defined in class c or 1 defined in class e ? also, confused in function call made in multilevel inheritance, in case of virtual functions etc. can 1 suggest book or article can me in understanding this. googled lot not able find helpful. thanks in advance. i want know dummy1 called. 1 defined in class c or 1 defined in class e ? given code, call 1 defined in c . if want call 1 defined in e , you'll have make dummy1 virtual function.

URL Rewrite from base (without prefix) .htaccess -

i developing short link website brand, , need have links this: http://demo-name.com/[shortvalue] i understand how following: http://demo-name.com/l/[shortvalue] using basic rewrite rule, however, unsure of how without prefix of l . i need able go to http://demo-name.com/file.php to run files, needs possible. if possible, able have http://demo-name.com/[shortvalue]?key=val&key2=val2 ^^^^^^^^^^^^^^^^^^ query string @ end of url's, if [qsa] possible well, great! you can test if file directory ( -d ) or file ( -f ) in rewritecond . rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/\.]+)$ index.php?shorturl=$1 [l,qsa] this rule rewrite "shortvalue" without slashes or dots index.php?shorturl=shortvalue .

servlets - JSESSIONID Issue When Tomcat Server is Acting As a Proxy for Another Tomcat Server -

i have (1) tomcat server app. proxying calls second (2) app server (3rd party), in: end-user --> (1) tomcat server app --> second (2) app server when end-user authenticates (1) tomcat server app, (1) tomcat server app, in turns logs second (2) app server on end-users behalf. the second (2) app server generates jessionid. need jessionid 1 associated end-user interacting (1) tomcat server app. the issue seems second (2) app server maintaing single session (1) tomcat server, if multiple end-users interacting (1) tomcat server, end sharing single session. (i hope made sense) what proper way handle situation? thanks in advance help! how invoke app2 app1 ? using http client library or similar? the issue seems second (2) app server maintaing single session (1) tomcat server, if multiple end-users interacting (1) tomcat server, end sharing single session. i can see 2 options you can store jsessionid of second app in session of first app. every time...

javascript - Update undefined in sailsjs model afterCreate hook -

in sailsjs app, i'm trying add default avatar user after user created have aftercreate hook in models/user.js : var user = { // ... attributes: { avatar: { model: 'image' }, // ... }, aftercreate: function(user, next){ var url = sails.config.s3 + "/" + sails.config.default_avatar; sails.log.info(user); // displays proper user var data = { url: url, isavatar: true, user: user.id }; image.create(data) .exec( function (err, image) { sails.log.info(image); // displays proper image user.update(image.user, { avatar: image.id}) .exec( sails.log.info ); }); next(); }, } i keep getting error: /users/rcanty/workspace/project/server/api/models/user.js:55 return user.update(image.user, { avatar: image.id}).exec( sails.log.info ^ typeerror: undefined not function @ /users/rcanty/workspace/project/server/api/models/user.js:55:19 @ bound (/usr/local/lib/node_modules/sails/node...

spring - Error : org/springframework/transaction/interceptor/TransactionInterceptor -

i have problem in spring configuration file application-context.xml please help!! receive error java.lang.noclassdeffounderror: org/springframework/transaction/interceptor/transactioninterceptor at org.springframework.transaction.config.annotationdrivenbeandefinitionparser$aopautoproxyconfigurer.configureautoproxycreator(annotationdrivenbeandefinitionparser.java:127) at org.springframework.transaction.config.annotationdrivenbeandefinitionparser.parse(annotationdrivenbeandefinitionparser.java:84) at org.springframework.beans.factory.xml.namespacehandlersupport.parse(namespacehandlersupport.java:74) at org.springframework.ide.eclipse.beans.core.internal.model.namespaces.delegatingnamespacehandlerresolver$elementtrackingnamespacehandler.parse(delegatingnamespacehandlerresolver.java:177) at org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1424) at org.springframework.ide.eclipse.beans.core.internal...

ruby on rails - How to get user posts Insights from Facebook API Koala Gem -

hi wondering how user posts insights facebook api koala gem. i found solutions works facebook page posts not user posts. i used code below user posts returns empty array. @graph.get_connections('me', 'insights', metric: 'page_impressions', period: 'now') update user = authentication.where(user_id: current_user.id, provider: "facebook").first oauth_access_token = user.token @graph = koala::facebook::api.new(oauth_access_token) @posts = @graph.get_connection('me', 'posts',{ fields: ['id', 'message', 'link', 'name', 'description', "likes.summary(true)", "shares", "comments.summary(true)"]}) the code above works fine, when try post insights, returns empty array. if using omniauth-facebook gem have make sure have right permissions in scope , can use original query. config/initializers/omniauth.rb omniauth.config.logger = rails.logger r...

angularjs - ui-router triggers child state before parent state is resolved -

i trying execute initialization code in parent state of angular ui-router. initialization code orderservice.getstoreinfo() returns promise. when promise resolved, want trigger child state. however, noticing child state triggered before parent's promise has resolved. doing wrong? here' code: function configure($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise('/'); $stateprovider .state('home', { abstract: true, template: '<ui-view/>', resolve: { storeinfo: /* @nginject */ function(orderservice) { console.log('home: resolve - orderservice.getstoreinfo()'); return orderservice.getstoreinfo(); } } }) .state('home.orders', { url: '^/', template: '<my-order-list data-orders="vm.orders"></my-order-list>...

javascript - onopen not responding in angular websocket -

i'm new websockets , i'm trying server respond when opening app in browser, connection.onopen not responding expected. can provide. angular.module('app') .run(function ($rootscope) { var url = 'ws://localhost:3000' var connection = new websocket(url) connection.onopen = function () { console.log('websocket connected') } })

c# - How to Split a List into two to populate differnt listviews? -

i have list gets populated api want split list 2 can populate 2 different listview on same screen how can this? items = new list<tableitem> (); items.add (new tableitem (){ subprofilename = "apple" }); items.add (new tableitem (){ subprofilename = "pear" }); items.add (new tableitem (){ subprofilename = "shoe" }); items.add (new tableitem (){ subprofilename = "cake" }); items.add (new tableitem (){ subprofilename = "vodka" }); items.add (new tableitem (){ subprofilename = "alize" }); ....... ....... ....... listview = findviewbyid<listview>(resource.id.listviewforsubprofiles); listview.adapter = new selectprofileadapter(this, items); you can use getrange() method part of list, in example need know how many items want in each group split them properly, let's have 10 items , want put 5 in each listview, can this: list<tableitem> firstlist = items.getrange(0, 5); list<tableitem> sec...

How to pass data between TabHost's Activities in android -

Image
i trying pass data between 2 activities of tabhost not succeded. here code: public class androidtablayoutactivity extends tabactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); tabhost tabhost = gettabhost(); tabspec livedata = tabhost.newtabspec("photoes"); livedata.setindicator("photoes", getresources().getdrawable(r.drawable.icon_photos_tab)); intent livedataintent = new intent(this, photosactivity.class); livedata.setcontent(livedataintent); tabspec addedlegs = tabhost.newtabspec("songs"); addedlegs.setindicator("songs", getresources().getdrawable(r.drawable.icon_songs_tab)); intent addedlegsintent = new intent(this, songsactivity.class); addedlegs.setcontent(addedlegsintent); tabhost.addtab(livedata); tabhost.addtab(addedlegs); ...

html - How to enable https protocol in a normal website? -

kindly let me know number of methods proceed query. nice of answering question. if want https need buy certifiate. here's useful link: https://support.google.com/webmasters/answer/6073543?hl=en

Implode multidimensional array with different glue in php -

i have array below: array ( [22] => array ( [0] => 60 [29] => array ( [0] => 6 ) [30] => array ( [0] => 5 [1] => 8 ) [31] => array ( [0] => 7 [1] => 9 [2] => 14 [3] => 26 ) ) [23] => 12 [35] =>10 [42] =>22 ) now want implode array like 60[6][5||8][7||9||14||26]|12|10|22 i have tried below code: $arr = array_map(function($el){ return $el['tag_id']; }, $arr); $str = implode(',', $arr); but not implode required glue how can it? you can use code <?php $a= array( 22 => array( 0 => 60, 29 => array( 0 => 6 ), ...

excel - Need to stop UDFs recalculating when unrelated cells deleted -

i've noticed udfs recalculate whenever delete cells. causes massive delays when deleting entire columns, because udf gets called each , every cell used in. if you're using 1000 udfs, deleting column or cell call 1000 times. by way of example, put following udf in module, call worksheet bunch of times =helloworld() function helloworld() helloworld = "helloworld" debug.print now() end function then delete row. if experience mine, you'll see gets called once every instance of use. anyone have ideas whether behavior can stopped? i'd interested why should called. seems flaw in excel's dependency tree me, there may reason. edit: after experimentation, i've found more actions trigger udfs: any change number of columns listobject (i.e. excel table) spans through resizing (but not rows). if udfs aren't in listobject concerned, or in fact in any listobject @ all. adding new cells or columns anywhere in sheet (but not rows). note manu...

c - Issue with program output -

below program determines perimeter , area of polygon given amount of (x,y) coordinates seem getting wrong output , can't see why. the input is: 3 12867 1.0 2.0 1.0 5.0 4.0 5.0 5 15643 1.0 2.0 4.0 5.0 7.8 3.5 5.0 0.4 1.0 0.4 with first entry being number of points (points) , second entry being polygon id, after set of coordinates. #include <stdio.h> #include <stdlib.h> #include <math.h> #define max_pts 100 #define max_polys 100 #define end_input 0 struct point { double x, y; }; double getdistance(struct point a, struct point b) { double distance; distance = sqrt((a.x - b.x) * (a.x - b.x) + (a.y-b.y) *(a.y-b.y)); return distance; } double polygon_area(int length, double x[], double y[]) { double area = 0.0; (int = 0; < length; ++i) { int j = (i + 1) % length; area += (x[i] * y[j] - x[j] * y[i]); } area = area / 2; area = (area > 0 ? area : -1 * area); return (area); } int main(int argc, ...

osx - How to check for a launched process is loaded or not in MAC OS X from shell script? -

i have launchd process unload, command have used launchctl unload /system/library/launchdaemons/costomscript.plist it works fine if process loaded. if not loaded , executed command gives message saying no such process loaded. need have check, if .plist file loaded should unloaded otherwise not. how can achieve this.. please help. thanks!! you can information running processes launchctl . one possibility querying launchd launchctl list command. list [-x] [label] with no arguments, list of jobs loaded launchd in 3 columns. first column displays pid of job if running. second column displays last exit status of job. if number in column negative, represents negative of signal killed job. thus, "-15" indicate job terminated sigterm. third column job's label. if plist loaded, should listed, otherwise not. first column contains pid of process, check if process running, examp...

How to parse following json in java so that I will get two objects and I can iterate over them? -

this question has answer here: how parse json 29 answers in below json, there 2 arrays. want them parsed in such way can iterate on them 1 one , store result. please find below content of json file. { "id": 1, "firstname": "katerina", "languages": [ { "lang": "en", "knowledge": "proficient" }, { "lang": "fr", "knowledge": "advanced" } ], "job": { "site": "www.javacodegeeks.com", "name": "java code geeks" } } { "id": 2, "firstname": "kati", "languages": [ { "lang": "fr", "knowledge": "average" }, { "lang": "h...

virtualbox - To install Devstack, how much memory should I use? -

i installed virtualbox , want install devstack on ubuntu 14.10, just test , how should specify ram memory , memory use vm? i have windows 7 32 bits intel i3 ram: 4 go (2.64 go usable) 27 go space left on disk thank much if doing testing, these recommended settings vm. processor - @ least 2 cores memory - @ least 8gb hard drive - @ least 60gb and use @ least 1 gb of ram suggest use 2gb ram perform well. reference: setup devstack

mysql - calculating no of users at each place -

i have table place store details place like place(id,name,detail,type,pid);//pid parent place id user(id,name,detail); user_place(uid,pid);//primary key of user , place table here place can area,city,state or country. i want track no of users perticular place like area want fetch total users of area i.e. 400 again city want fetch total user(that total user of area of city) i.e 50000(for city). similar state , country. for calculation above data, place table structure correct? or modification required? how calculate no of users according city,state,country? assumptions: user in area . area in city , city in country . total number of users in area arkham : select count(up.uid) place p inner join user_place on p.id = up.pid p.type = 'area' , p.name = 'arkham'; total number of users in city gotham , has multiple areas. select count(up.uid) place p inner join place p2 on p.pid = p2.id , p.type = 'area...

google maps - Django (Geo) Geocode - geocode on model save not working -

i've got save override on model: def save(self, **kwargs): if not self.location: address = u'%s %s %s %s' % (self.address_first, self.address_second, self.address_third, self.postcode) geocoder = nominatim() try: _, latlon = geocoder.geocode(address) except (geopyerror, valueerror): pass else: latlon = geocoder.geocode(address) point = 'point({0} {1})'.format(latlon[1][1], latlon[1][0]) self.location = geos.fromstr(point) super(venue, self).save() i getting typeerror: 'nonetype' object not iterable specifically on address variable. works fine if hardcode address in. i assume it's fact self.address... not available until after model has saved? what's best way this? save twice? thanks updated in case else has issue. google expecting api requests have address in such format line1+line2+line3+zipcode, rather line1, line2, line...

mysql - Why foreman requires package foreman-mysql2-1.7.4-1.el6.noarch -

why requires install it's mysql package when have mysql installed, sorry if sound stupid learning point. foreman-mysql "foreman" side client code. particular server doesn't have it, have "foreman-postgresql" example. not "server" package, since theforeman works multiple databases, require whatever client side code need support preferred database server. tommy

c++ general int array and vector iterator -

in following code, need define iterator can iterate on both vector<int> , int[100] . how define mi here? template<class arraytype> void array_show(arraytype array, size_t arraysize) { // how define mi???? (mi = array; array != m.end(); array++) std::cout << " " << *mi << std::endl; } here example below. importantpart use arraytype& - reference, way regular array not decayed pointer - way possible read size inside array_show. template<class arraytype> void array_show(arraytype& array, size_t arraysize) { // how define mi???? (auto mi = std::begin(array); mi != std::end(array); mi++) std::cout << " " << *mi << std::endl; }

c# - Frame Capture using Matrox Commands -

i'm working on project have set fps of video stream (as 10) camera , grab frame every 5th frame. i'm working on program has been half written else. thing is, have used matrox framegrabber dlls. there matrox frame grabber on device. cant find commands framegrab in c#. found following code c++. mil_id mdispalloc(systemid, dispnum, dispformat, initflag, displayidptr) where mil_id systemid; system identifier long dispnum; display number char *dispformat; display format name or file name long initflag; initialization flag mil_id *displayidptr; storage location display identifier the above command allocates display. can please me write program in c#. also, experience in matrox dlls please give me idea on how approach frame capture , fps set up. thanks. this new matrox framegrabber. first thing should add matrox dll reference. aware there 2 matrox versions out- matrox 9 , matrox 10. depending on version of matrox installed in user system dll should added. (this ca...

convert columns to rows sql server -

Image
this question has answer here: sql server dynamic pivot query? 6 answers these data: and want have result: please note values inserted column "app", haven't got same value or same quantity, once find 2 rows , time 10 rows you can use temp table store app values, concat them variable. using t-sql can construct dynamic pivot: create table #vals (vals nvarchar(max)) insert #vals select distinct app [table1] declare @sql nvarchar(max) declare @vals nvarchar(max) select @vals = coalesce(@vals+', ','') + '[' + vals + ']' #vals set @sql = ' select name, '+@vals+' [table1] pivot (max([version]) app in ('+@vals+')) piv' print @sql exec (@sql)

Security surrounding the iOS shared NSHTTPCookieStorage -

i'm struggling find exact details on this, i'm hoping here. i'm looking information regarding underlying storage mechanism of ios shared nshttpcookiestorage: when cookies stored using shared nshttpcookiestorage, there encryption provided default, such use of keychain services? or cookies stored in plaintext using nsuserdefaults? i understand cookies stored within app's sandbox, other apps not have access, understanding correct physical access device can access app's cookies , values (especially if stored unencrypted)? if 1 had handle sensitive data in cookies wanted utilise default cookie handling/storage (shared nshttpcookiestorage) of nsurlsession apis instance, best option? sorry, know i've asked 3 separate questions on appreciated. thanks. i don't know how cookies stored, all application files encrypted on ios, aes256 key specific app. keys derived other keys come "secure enclave" within cpu chip, release keys when user...

Programmatically modify cron schedule in Google App Engine -

i writing wrapper around github issues api allow managers in company set daily reminder emails sent devs. want configurable through admin console, , give them flexibility of setting reminders @ time of day , number of times day. the main app engine cron system configured statically through cron.yaml file , cannot changed user action. looking @ documentation appears can reimplementing entire cron infrastructure on top of basic app engine cron. missing something? there available elsewhere? you correct, cannot setup programmatically cron configuration. you can configure single cron triggers customized functions. functions can read configured crons (like datastore entities) , launch different task based on needs

Symfony 2 -security.yml: How to create an exception pattern inside the firewalls? -

example: have inside firewalls secured_area: pattern: ^/ form_login: check_path: /secured/login_check login_path: /secured/login logout: path: /secured/logout target: / context: primary_auth i access pattern => ^/toto without login. please, me ? with this, can access it. #change path security: secured_area: anonymous: ~ pattern: ^/ form_login: check_path: /secured/login_check login_path: /secured/login logout: path: /secured/logout target: / context: primary_auth access_control: - { path: /toto, roles: is_authenticated_anonymously } - { path: ^/login, roles: is_authenticated_anonymously } - { path: ^/ , roles: role_user } edit : don't forget anonymous : ~ (let anonymous user use (for toto)) and let auth...

R difference between dates with different formats -

what i'm trying calculate total days between 2 dates. if dates in "yyyy/mm/dd" format did way: enddate <- "2012/02/01" startdate <- "1900/01/01" diffbewtweendates <- data.frame(date=c(enddate),start=c(startdate)) diffbewtweendates$date_diff <- as.date(as.character(diffbewtweendates$date), format="%y/%m/%d")- as.date(as.character(diffbewtweendates$start), format="%y/%m/%d") diffbewtweendates and worked. i'm requested @ least enddate in format "fulldayname, daynumber of fullmonthname of fullyearnumber". "sunday, 1 of february of 2012" . as understand r manual, ... format="%a, %d of %b of %y" doesn't work , can't figure out why. thanks in advance idea. perhaps got change locale english: sys.setlocale("lc_time", "english") date <- "sunday, 1 of february of 2012" lubridate::guess_formats(date, orders = "dmy") # ...

cordova - Phonegap: Button Handlers executing unexpectedly -

this first phonegap helloworld attempt, , first attempt @ doing single page application. in summary, have index.html has div id "subscreen". have 2 buttons. each button load handlebar template div. questions: when moment start app, button handlers fired in sequence ( alert message screen 1 , screen2). , when click on buttons, nothing happens, if event bind not done properly. maybe have error in javascript can't tell is! behold simple index.html: <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <meta name="msapplication-tap-highlight" content="no" /> <!-- warning: ios 7, remove width=device-width , height=device-height attributes. see https://issues.apache.org/jira/browse/cb-4323 --> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, min...