Posts

Showing posts from August, 2012

java - Generics with same base class -

i have treenode class defined so: class treenode<t extends myclass> { public t element; public treenode<? extends myclass> parent; public arraylist<treenode<? extends myclass>> children; } i know if there easier way restrict treenodes generic type variables extend myclass ? having write out arraylist<treenode<? extends myclass>> tedious. can't arraylist<treenode<t>> because tree cannot contain nodes different inheritance of myclass. i tried this: public static const class node_class = treenode<? extends treenode>.class; don't think can use generics part of class object. someting synonymous c++'s typedef guess, i.e. typedef treenode<? extends myclass> nodeclass; since comment seemed you, i'll post answer: i don't see point of using generics if t doesn't match between nodes in tree. given that, element should myclass .

How to detect this unprintable character using regex or other ways in Ruby? -

i came upon strange character (using nokogiri). irb(main):081:0> sss.dump => "\"\\u{a0}\"" irb(main):082:0> puts sss => nil irb(main):083:0> sss => " " irb(main):084:0> sss =~ /\s/ => nil irb(main):085:0> sss =~ /[[:print:]]/ => 0 irb(main):087:0> sss == ' ' => false irb(main):088:0> sss.length => 1 any idea strange character? when it's displayed in webpage, it's white space, doesn't match whitespace \s using regular expression. ruby thinks it's printable character! how detect characters , exclude them or flag them whitespace (if possible)? thanks it's non-breaking space. in html, it's used pretty , written &nbsp;. 1 way find out identity of character "\u{a0}" search web u+00a0 (using 4 or more hexadecimal digits) because that's how unicode specification notates unicode code points. the non-breaking space , other things included in...

ios - UIPercentDrivenInteractiveTransition captures all sublayer animations -

i have created interactive transition using uipercentdriveninteractivetransition problem i'm having percent driven transition capturing animations in tovc is there way make them independent?

php exec() for java on website doesn't work but works in server terminal -

i have vps (linux server) downloaded 64-bit version of java. on terminal, able run commands such as: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java -version and receive following output: openjdk version "1.8.0_65" openjdk runtime environment (build 1.8.0_65-b17) openjdk 64-bit server vm (build 25.65-b01, mixed so test website, used following php: <?php $output = array(); exec('/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java -version', $output); foreach($output $line) { echo $line; echo '<br/>'; } ?> but receive following error: error occurred during initialization of vm not allocate metaspace: 1073741824 bytes so far have tried following: 1) i've updated permissions on java that: stat -c "%a %n" /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/bin/java returns: 755 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_6...

scala - How to generically wrap a Rejection with Akka-Http -

i use akka http routing system, along rejection system need nest response json rejection within generic json message block. i have working in non-generic manner creating rejectionhandler adding cases possible rejections , handling them specific response code , message. example: // wraps string control block format def wrappingblock(msg: string) = ??? val myrejectionhandler = rejectionhandler .newbuilder() .handle{case malformedrequestcontentrejection(msg, detail) => complete(badrequest, wrappingblock(msg)) } ... // further lines other possible rejections ... // along response codes , messages. ... // nice if generic code ... // rather specific every rejection type. .result() val routes = handlerejections(myrejectionhandler){ ... } however, response code akka http provides default , pretty print message provided, nested within json control wrapper without line every possible rejection type. seems should possible have not been able ...

xcode - Architecture missing x86-64 in file -

my app has been working fine several weeks, today accidentally deleted architecture in xcode, , can't work again. have been seeing similar problems here on stack, far solutions has not worked me. i error: missing required architecture x86_64 in file /users/**/desktop/app/recipebookparseupdate/parse.framework/parse (3 slices) i can't remember architecture using before when working fine...

Java 8 Streams: How to call once the Collection.stream() method and retrieve an array of several aggregate values -

this question has answer here: how minimum , maximum value list of objects using java 8 1 answer i'm starting stream api in java 8. here person object use: public class person { private string firstname; private string lastname; private int age; public person(string firstname, string lastname, int age) { this.firstname = firstname; this.lastname = lastname; this.age = age; } public string getfirstname() { return firstname; } public string getlastname() { return lastname; } public int getage() { return age; } } here code initializes list of objects person , gets number of objects, maximum age , minimum age, , create array of objects containing these 3 values: list<person> personslist = new arraylist<person>(); personslist.add(new person("john", ...

doctrine2 - Doctrine 2 way too slower than Laravel's Eloquent -

i'm trying use doctrine 2 ( laraveldoctrine ) instead of eloquent . performing simple query of getting paginated data: // doctrine $orders = $this->orderrepository->paginateall(50); // eloquent $orders = $this->orders->paginate(50); i end doctrine queries taking time (info laravel debugbar): doctrine queries took 3.86s 1.79s select distinct id_0 (select o0_.id id_0, o0_.customer_id customer_id_1, o0_.customer_ref customer_ref_2, ... orders o0_) dctrn_result limit 50 offset 0 16.63ms select o0_.id id_0, o0_.customer_id customer_id_1, o0_.customer_ref customer_ref_2, ... orders o0_ o0_.id in (?) 2.05s select count(*) dctrn_count (select distinct id_0 (select o0_.id id_0, o0_.customer_id customer_id_1, o0_.customer_ref customer_ref_2, ... orders o0_) dctrn_result) dctrn_table eloquent queries took 50.38ms 36.73ms select count(*) aggregate `orders` 13.65ms select * `orders` limit 50 offset 0 i'm not pasting whole doctrine quer...

SQL Server 2014 Partitioning -

i need figuring out how best partition large transaction table in sql server 2014. transaction table has clustered index on date, primary key identify each record, , institution id identify institution transaction belongs not part of index. table houses data 3 small institutions, combined data on 6 years have made table bloated efficient querying. would make sense first alter table include institution id in clustered index , partition year/institution id this: fg1 -> 2008 institution 1 fg2 -> 2008 institution 2 fg3 -> 2008 institution 3 fg4 -> 2009 institution 1 fg5 -> 2009 institution 2 fg6 -> 2009 institution 3 .... or partitioning year regardless of institution fine (no need alter clustered index) this: fg1 -> 2008 fg2 -> 2009 fg3 -> 2010 ...

c# - Having a copy of an object instead of a locked one -

is there way of, instead of locking object, show temporary copy of it, 1 accessing it? wrap code uses object in case critical resource, transactionscope , set isolationlevel snapshot. that way, trying access same object should see value before editing object, until transaction complete.

What are the differences between a pointer variable and a reference variable in C++? -

i know references syntactic sugar, code easier read , write. but differences? summary answers , links below: a pointer can re-assigned number of times while reference cannot re-seated after binding. pointers can point ( null ), whereas reference refer object. you can't take address of reference can pointers. there's no "reference arithmetics" (but can take address of object pointed reference , pointer arithmetics on in &obj + 5 ). to clarify misconception: the c++ standard careful avoid dictating how compiler must implement references, every c++ compiler implements references pointers. is, declaration such as: int &ri = i; if it's not optimized away entirely , allocates same amount of storage pointer, , places address of i storage. so, pointer , reference both occupy same amount of memory. as general rule, use references in function parameters , return types define useful , self-documenting interfaces. use ...

android adb shell script - how to pull all sharedpreferences -

i need run script in debug mode pull sharedpreferences folder. research can pull debug builds. tried non-rooted phone sharedpreferences this: $adb shell $adb run-as mypackagename then able traverse /data/data/mypackagename/shared_prefs but i'd able put in script. can call adb pull outside adb shell. how can shared_prefs entire folder pulled out of normal non-rooted device on debug application ? there must way because how facebook setho doing it ? this question retrieving sharedpreferences not database retrieval. i created following shell script #!/bin/bash pname=$1 if [ -z "${pname}" ]; echo "please enter package name" exit 1 fi adb shell "run-as $pname chmod 776 shared_prefs" adb pull /data/data/$pname/shared_prefs ./${pname}_shared_prefs adb shell "run-as $pname chmod 771 shared_prefs" name pullsharedprefs.sh (or whatever want) , terminal run command: chmod +x pullsharedprefs.sh ./pullsharedprefs....

python - Move, Resize an image in a QGraphicsScene -

is there way put image (png) in qgraphicsscene, move , resize mouse? there's diagram scene example should give idea how it: http://doc.qt.io/qt-5/qtwidgets-graphicsview-diagramscene-example.html for adding image qgraphicsscene , use qgraphicspixmapitem

javascript - Loading a page from hash on refresh -

so wrote piece of javascript using jquery library. functionality have pages load inside of div instead of entire page (to make modifying layout way easier). i've made saves 'file url' in hash , i've made loads correctly, can't life of me figure out how go page. when try go page hash in name (so example refreshing page, or going through link/url) replicates (i think) 2 times inside each other. can see happening live @ overeten.be , try refresh random page except main one. could me problem? in advance! $("document").ready(function(){ $('._body').load("pages/default.html"); var locationhash = window.location.hash.replace('#',''); if ((locationhash=='pages/default.html')||(locationhash=='')){ console.log("no page, "+locationhash); } else{ $('._body').load(window.location.hash); console.log(locationhash); } $('.menubundle a, ...

javascript - Check if clicked element is descendant of parent, otherwise remove parent element -

i trying write script in vanilla js (no jquery) remove element page if clicks outside of element. however, div has many nested elements , way had set disappears clicking element within first element. example markup: <div id='parent-node'> master parent node <div id ='not-parent-node'> not parent node <button>button</button> <div id='grandchild-node'> grandbaby node </div> </div> </div> so no matter how nested element is, check see if descendant of <div id='parent-node'> element. if click there, not rid of parent node , descendants. div , descendants should only removed dynamically when clicking outside of parent div . currently have , know there serious fallacies in wrote: function remove(id) { return (elem = document.getelementbyid(id)).parentnode.removechild(elem); } document.addeventlistener("click", function (e) { remove('par...

xslt - Why perform transformations in middleware? -

a remote system sends message via middleware (mq) application. in middleware transformation (using xslt) applied message. reformatted , there no enrichment nor validation. system consumer of transformed message , xslt maintained team. the original author of of has long gone , wondering why thought idea transformation in middleware rather in app. can't see value in moving middleware, makes less visible , less simple maintain. also have thought xslt maintained message producer not consumer. are there guidelines sort of architecture? has done right thing here? it bad idea modify message body in middleware. negatively affects maintainability , performance. the reason of doing trying connect 2 incompatible endpoints without modifying them. require transformation of source content understood destination endpoint. the motivation delegate middleware perform transformation political 1 (endpoints maintained different teams, management reluctant touch endpoint code, e...

http - What is included in URI character limit -

when uri has character limit of 255 characters, 'http://' or 'https://' included while counting characters? tried google it, couldn't find definite answer. http:// , https:// not included in uri length limit of 255 (of older client or proxy implementations). source: this , personal experience/knowledge (couldn't find formal ref).

angularjs - Error: [ng:areq] Argument 'ext-modules/fleet/jsFleetController.js' is not a function, got undefined -

am getting "error: [ng:areq] argument 'ext-modules/fleet/jsfleetcontroller.js' not function, got undefined" error message when ever load template file. the following code, please can wrong in code. thank you. index.html <!doctype html> <html ng-app="myapp"> <head> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title>truck trackers</title> <link href="content/bootstrap.min.css" rel="stylesheet" /> <link href="content/font-awesome.min.css" rel="stylesheet" /> <link href="main/app.css" rel="stylesheet" /> <link href="ext-modules/fleet/jsfleet.css" rel="stylesheet" /> <link href="ext-modules/drivers/jsdrivers.css" rel="stylesheet" /> <script src="scripts/angular.js...

Spark job with custom Docker image from private registry -

i build custom docker image can used spark's spark.mess.executor.docker.image configuration option. image contain private information need kept in private registry. possible? don't see documented way specify login credentials part of spark-submit command. it seems should specify url docker credentials file part of spark.mesos.uris spark-submit option.

c++ - Serialize/deserialize unsigned char -

i'm working on api embedded device, , need display image generated (by api). screen attached device allows me render bitmaps, data stored unsigned char image[] = { 0b00000000, 0b00001111, 0b11111110... } . what easiest way deserialize string in whatever format needed? my approach create stringstream , separate comma , push vector<char> . however, function render bitmaps accept char , , can find online seems quite difficult convert it. ideally, i'd rather not use vector @ all, including adds several kbs project, limited in size both download speed of embedded device (firmware transferred edge) , onboard storage. from comments, sounds want convert string composed of series of "0b00000000" style literals, comma separated, array of actual values. way to: get number of bytes in image (i assume known string length?). create std::vector of unsigned char hold results. for each byte in input, construct std::bitset string value, , actual value. ...

neo4j script file format - is there any? -

i predefine graph data neo4j , able load it, maybe via console tool. i'd precisely same mysql cli , .sql files. know if there exists file format .neo or .neo4j ? couldn't find such thing in docs... we .cql or .cypher script files. can pipe shell run it, so: ./neo4j-shell -c < my_file.cypher michael hunger doing great work on feature, also, recently. got performance , noise down console. hope gets 1.9 release.

javascript - Ranking a Google visualization Table -

so have far rank table @ first see main table (allstores table) , when click on rank header table owners stores pop shows owners rank in respect other competitors stores. want arrow sort event on each of headers in main table. did find solution gives me doing solution not show owners stores table.you can see code in jsfiddle . google.setonloadcallback(draw); google.setonloadcallback(drawmystores); var data = new google.visualization.datatable(); function allstores() { data.addcolumn('number', 'rank'); data.addcolumn('string', 'store name'); data.addcolumn('number', ' sales'); data.addcolumn('number', 'sos'); var raw= ([ [1 ,'bayfair', 4895, 68 ], [2 ,'greerton', 3158, 126], [3 ,'frankton', 3689, 79], [4 ,'mt manganui', 3069, 72], [5 ,'tauranga', 2689 , 68], [6 ,'te rapa', 2269, 143], [7 ,'the base', 1895, 125], ...

vb.net - A possibility of removing excessive code when dynamically creating objects? -

wanted know if there shorter way of writing i'm writing when dynamically creating form objects. code below: ' margins & width buttons dim distancex integer = left + 20 dim distancey integer = 120 dim btnwidth integer = 120 ' initializing buttons removeundbtn = new button numbbtn = new button capsbtn = new button subsbtn = new button addtagsbtn = new button previewbtn = new button applybtn = new button cancelbtn = new button ' settings buttons removeundbtn .text = "remove underscore" .visible = true .enabled = false .top = distancey .width = btnwidth .left = distancex addhandler .click, addressof removeundaction end numbbtn .text = "number songs" .visible = true .enabled = false .to...

mininet - What alternatives SDN controllers to POX are available? -

i advice best open-source sdn controller available. want implement , test ideas have in research need use simulation such mininet . in fact, familiar mininet , able deal it. however, mininet uses pox controller bit tedious , not user friendly when comes manage network topology , modify flows, becomes hard task since need hard code scratch ( beginner in python well). there user-friendly sdn controller can use instead pox? i've tried floodlight , opendaylight there not ready , involves many bugs. thank you. nox it began nox. while might argue, nox first openflow controller attracted whole lot of researchers around , achieved have wide acceptance. majority of primary software-defined networking (sdn) , openflow papers , applications implemented on top of nox. google used nox build (prototype?) own distributed openflow controller, called onix. being said, fuss left in 2010. on nox mailing-lists abandoned , no major changes know of introduced code base. pox pox ca...

php - PDO with self signed certificates -

i'm still tryin connect pdo remote mysql database. customer provide self signed certificates, client-key.pem , client-cert.pem . certificates good, can connect remote db using mysql client. instantiate pdo object connect db. pdodb = new pdo( 'mysql:host=customer_host_name;dbname=customer_db_name', 'my_username', 'my_password', array( pdo::mysql_attr_ssl_key=>'c:/apache24/htdocs/client/lib/client-key.pem', pdo::mysql_attr_ssl_cert=>'c:/apache24/htdocs/client/lib/client-cert.pem' )); i'm getting error when instantiate pdo object: warning: pdo::__construct(): ssl operation failed code 1. openssl error messages: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed in c:\apache24\htdocs\customer\lib\database.php on line 17 i think code correct i'm newbie php. update pardon me. forgot mention didn't specify value mysql_attr_ssl_ca because customer doesn't give m...

javascript - How to fully close a WebRTC connection -

Image
when trying close webrtc connection after call using rtc.close(), recognize about:webrtc-internals in chrome , about:webrtc keep connections listed. in firefox, marked closed, while in chrome not see such denotation. i asking because seems have significant performance impact after time. after having done lot of calls, performance impaired , webrtc-internals lists large number of connections. is there more closing webrtc connection .close() make browser forget connection? you should see peer connection go iceconnectionstateclosed , signalingstateclosed . 1 thing should ensure you're stopping local media stream tracks. if don't, browser keep them open, because aren't closed when peer connection closed.

angularjs - Is there a way to access complete angular URL (with #!) in JAVA filter? -

we have many pages implemented using angular js. have created offline snapshot html , store web crawlers. now when web crawler asks particular page, based on user agent value redirect request java servlet returns appropriate snapshot page crawler. when request comes in servlet crawler (like endeca), url till #.. , after # in url lost hence servlet not able return corresponding snapshot. i know not possible send complete url (along #) via http request want know if there way overcome issue. curl -a "endeca webcrawler" "http://test.com/test#!/test1/id" in java servlet filter http://test.com/test note: google , bing bit convert #! _escaped_fragment hence don't see issues crawlers.

javascript - webpack loaders and include -

i'm new webpack , i'm trying understand loaders properties such test, loader, include etc. here sample snippet of webpack.config.js found in google. module: { loaders: [ { test: /\.js$/, loader: 'babel-loader', include: [ path.resolve(__dirname, 'index.js'), path.resolve(__dirname, 'config.js'), path.resolve(__dirname, 'lib'), path.resolve(__dirname, 'app'), path.resolve(__dirname, 'src') ], exclude: [ path.resolve(__dirname, 'test', 'test.build.js') ], cachedirectory: true, query: { presets: ['es2015'] } }, ] } am right test: /.js$/ used files extension .js? the loader: 'babel-loader', loader install using npm the include: have many questions on this. right put inside array transpiled? means, index.js, config.js, , *.js files ...

java - OutOfMemoryError error when changing the tint color of Vector images -

i have @ least 48 small images displaying vector images stored xml file in drawable. have multi choice listview 48 items. when item checked access image counterpart , change tint of image. if less (approximately) 30 items checked, there no problem, if it's more that, outofmemoryerror displayed. here example of code: view.onclicklistener listener= new view.onclicklistener() { @override public void onclick(view v) { sparsebooleanarray checked = listview.getcheckeditempositions(); (int = 0; < checked.size(); i++) { // item position in adapter int position = checked.keyat(i); // add sport if checked i.e.) == true! image = null; if (checked.valueat(i)) { switch (position) { case 1: image = (imageview) findviewbyid(r.id.image1); ...

Android: Executing a program on adb shell -

i have created executable using "include $(build_executable)" command in android.mk . requirement execute above generated executable on abd shell. i tried: below c-code compiled using ndk-build command: #include <stdio.h> int main() { printf("\n\nhello world\n\n"); return 0; } following android.mk file contents: local_path := $(call my-dir) include $(clear_vars) local_module := helloexecutable local_src_files := hello.c include $(build_executable) when execute command ndk-build following file generated: projectroot->libs-> helloexecutable my job execute above generated file on adb shell. first pushed file onto sdcard using following command: adb push ~/projectroot->libs->helloexecutable /sdcard/ now switch adb shell using: $adb shell command(here i'm using emulator). then change permissions as: chmod 777 /sdcard/helloexecutable once above command executed, executing permissions helloexecutable file....

Should we also check for the number of signatures on Android tampering detection -

i have code (copied here: https://www.airpair.com/android/posts/adding-tampering-detection-to-your-android-app ) add tampering protection android application. it possible submit application play store multiple signatures? should validate method packageinfo.signatures returns 1 signature? or apk can have multiple signatures , of them valid? private static final int valid = 0; private static final int invalid = 1; public static int checkappsignature(context context) { try { packageinfo packageinfo = context.getpackagemanager().getpackageinfo(context.getpackagename(), packagemanager.get\_signatures); (signature signature : packageinfo.signatures) { byte[] signaturebytes = signature.tobytearray(); messagedigest md = messagedigest.getinstance("sha"); md.update(signature.tobytearray()); final string currentsignature = base64.encodetostring(md.digest(), base64.default); //compare signatur...

How to set IDENTITY_INSERT to OFF for all connection in SQL Server? -

i aware can turn off identity_insert current connection using following command set identity_insert table on but want set on connection 10 minutes , want turn off. is possible? if how can this?

php - Marksheet program: addition in codeignitor -

i trying make marksheet in php, mysql using codeignitor. have used xampp , created database.to store each record.the data being retrieved database, new record inserted edited but problem in retrieving sum. not giving me sum answer means total marks. pasting code here, please me or correct me if wrong, new codeignitor. i have tried function array_sum() , not giving me answer. , not giving me error code or query. either query sum in marksheet wrong or answer can't fetched view. model/marksheet.php file function tm() { $data = array( 'math' => $_post['math'], 'eng' => $_post['eng'], 'bio' => $_post['bio'], 'total_marks' => $_post['total_marks']); $this->db->insert('marks', $data); // $mark = array_sum($data); $mark= $_post['math'] + $_post['eng'] + $_post['bio']; return $mark; } c...

php - Fixed Table Size -

foreach($model $person) { if($n % 3 == 0) $html = $html .'<tr>'; $html = $html . '<td width="95px" style="text-align:center">'. student photo.'</td>'; $html = $html . '<td width="80px">'.name.'</td>'; if(($n+1) % 3 == 0) $html = $html . '</tr>'; $n++; } $html = $html . '</table>'; echo $html; i want display 3 sets of student pic + name in each row. display nicely how want be.however, when display 1 or 2 records,the data not fixed. * want same size/position 3sets data i can't tell styles may have applied table, think going on: cells changing position because when have 1 or 2 entries, table 2 or 4 cells wide, unlike when have 3+ entries, table 6 cells wide. since you're using percentage-based widths name cells, you'll weird effects name cells try compute how ...

sql server - Replace varchar length with a constant macro -

normally define varchar in sql server this. in store procedure, input varaible @name declared @name varchar(32); however, "32" hard coded. other developer use 24, 64 or else in other store procedure. it hard maintain. is there way write this? @name varchar(var_name_length); var_name_length defined somewhere globally, c #define var_name_length 32 then developer stick use macro instead of hard code 32. not sure if possible in sql server. or other idea? note: sql server version 2008 sp2. it possible using user-defined data types . but, in practice not useful, because can't change definition of custom type. see article bad habits kick : using alias types aaron bertrand more details. in comments article alexander kuznetsov said: actually badly need ability define type once , use many times. accomplish that, use macros , run standard c++ preprocessor against sql code expand them. for example, convert in include file used ...

javascript - Transfer Directives to Child DOM Elements -

i've created custom directive textbox augmented markup. module.directive("inputfield", ["$log", function($log) { return { restrict: "e", replace: true, scope: { labeltext: "@" }, templateurl: "input-field.template.html" } }]); template file: <div class="fancy-field"> {{ labeltext }}: <input type="text"> </div> i want directive support adding standard html5 input attributes , angular directives , apply them child input. accomplish transferring selected attributes parent <div> element inner <input> in directive's compile function. compile: function(element, attributes) { var inputelement = $(element.children("input")[0]); if(attributes.innerdirective) { // transfer inner-directive element specified on parent // child input inputelement.attr("inner-directive", attr...

How to make my android widget wait until i fetch content -

i'm working on android widget fetches content api. what i'm using custom function uses callback included in onupdate => api.getlastitems(mycallback). mywidget provider : public void onupdate(context _context, appwidgetmanager _appwidgetmanager,int[] _appwidgetids) { api.getlastitems(new requestcallback() { @override public void onfinish(object object) { arraylist<string> announcs_titles = (arraylist<string>)object; final int n = widgetid.length; (int = 0; < n; i++) { intent myintent = new intent(context, widgetservice.class); myintent.putextra(appwidgetmanager.extra_appwidget_id,widgetid[i]); myintent.putstringarraylistextra("itemstitles",items_titles); ... appwidgetmanager.updateappwidget(widgetid[i], widget); } } }); super.onupdate(context, appwidgetmanager, widgetid); } because remoteviewsservice.remoteviewsfactory use spec...

portforwarding - How SSH forward HTTP request to backend server? -

we have 3 machine, say, a, may laptop, b, jump machine, , c web server. jump server can access public network without limitations, web server c limited, , only port 22 (ssh service) opened b, , can talk dual-direction via ssh. we want deploy web server on c, bind port 7788, can configure b forward following request c on port 7788, , without configure c? curl b.ip:7788 it doesn't require special configuration on b, except port forwarding must allowed (allowtcpforwarding). on a, $ ssh -l17788:c.ip:7788 b.ip then on a, browse to http://localhost:17788/ there's nothing special 17788, can use free localhost port on a. add 10000 tunnelled destination port keep simple , easy remember.

vb.net - Gmail API sending limits -

i saw in articles sending limit gmail is: *500 per day if send website *100 per day if send pop/imap application my questions are: 1.- "100 per day" limit vb net apps can make? 2.- how many mails can send using gmail api (or how many recipients)? 3.- how can extend limit free account? regards. based on usage limits page of gmail api documentation, have 1,000,000,000 quota units per day daily usage , 250 units/user/second rate limit. all method transactions have allocated quota units, if we're looking @ send method (either drafts/messages), cost 100 units.

java - org.restlet.routing.Router doesn't seem to accept encoded slashes -

i using restlet , having issues router template variable in template contains encoded slashes. here's details: when use route: /blob/sqlserver/{uniqueid} and pass (note %2f /): /blob/sqlserver/refinance-other%2ffrm%2f660-700%2f4.00-4.50%2fproperties-4.00-4.50.csv or this: /blob/sqlserver/refinance-other/frm/660-700/4.00-4.50/properties-4.00-4.50.csv i 404 if use router: /blob/sqlserver/{purpose}/{type}/{creditscore}/{interestrate}/{file} and pass this: /blob/sqlserver/refinance-other/frm/660-700/4.00-4.50/properties-4.00-4.50.csv it works, can't way, because don't control sending me uri , variables change, has encoded slashes. to test further tried template again: /blob/sqlserver/{uniqueid} but used mode_starts_with .setmatchingmode(template.mode_starts_with); when that, find this: /blob/sqlserver/refinance-other/frm/660-700/4.00-4.50/properties-4.00-4.50.csv but "refinance-other" variable under uniqueid. however, encod...

c# - How to create a custom FluentValidation PropertyValidator with specific validation error messages? -

i have several different classes name property of type string , rules validating name in each case same, e.g. must not null, between 1 , 32 characters, must not contain invalid/symbol characters etc. - idea. i using fluentvalidation library validation. new it, i've seen far. started creating abstractvalidator<t> derived validation classes each class in object model validate properties. realized duplicating code validate name properties of various classes, decided create namevalidator custom property validator (i.e. custom propertyvalidator derived class). intent encapsulate 4 or 5 pieces of repetitive name validation logic in 1 place. what don't solution (based on novice understanding) can't specify different, specific validation error message based on criteria validation fails because error message has defined in constructor , passed on base class. in other words, validation error message tied class type, not runtime logic within isvalid(...) overrid...

Using Jasmine to `spyOn` a function in a (different) closure -

Image
we're using require , browserify, single-function modules imported this: var loadjson = require('../loadjson'); and used this: x = loadjson(url); i'd spyon loadjson function, doesn't seem possible. it's not global function, doesn't work: spyon(window, 'loadjson') it's not local function, doesn't work: loadjson = createspy('loadjsonspy', loadjson).and.callthrough(); when require module jasmine spec, function visible inside closure, that's not same closure other module using loadjson real. so in short, think it's not possibly use spyon in case - correct? creative workarounds? if loadjson singleton, can this. var functionstospyon = {loadjson: loadjson} spyon(functionstospyon, 'loadjson') this workaround used when had same problem.

What is the proper ansi c example for windows? -

some books claim used ansi c , use turbo c compiler run these example. tried run these on linux found these example windows. #include<stdio.h> #include<conio.h> /* #include<dos.h> */ int main() { int a; clrscr(); scanf("%d", &a); printf("%d",a); getch(); return 0; } can call above example ansi c? why or why not? as @milevyo said, functions implemented borland's compilers. on windows can replace clrscr() system("cls") , getch(); _getch(); or, better, getchar() .

windows - In a batch file, how would I find the specific folder it is in without the rest of its directory? -

okay, want batch file detect whether if can find file inhabiting , not else. for example: receive path, (down there) variable %~dp1. c:\users\%username%\desktop\file\file1.bat but want receive section of directory, "\file\", , check whether batch file can find out if directory exists. here solution, did not code solution file being in root. variable f believe asking for. foo.cmd @echo off setlocal ::: p parent ::: g grandparent ::: grandparent absolute ::: f folder of batch file set p=%~dp0 set g=%~dp0\.. /f "delims=" %%t in ("%g%") set "a=%%~ft" call set f=%%p:%a%=%% call set f=%%f:\=%% echo p is: %p% echo g is: %g% echo is: %a% echo f is: %f% endlocal test cases l:\test>foo.cmd p is: l:\test\ g is: l:\test\\.. is: l:\ f is: test l:\test>md subdir l:\test>cd subdir l:\test\subdir>..\foo.cmd p is: l:\test\ g is: l:\test\\.. is: l:\ f is: test l:\test\subdir>copy ..\foo.cmd 1 file(s) copi...

android - Parse.com boolean statements -

all; i making android application need adjust image if in backend variable true or false. when user adds new parseobject, automatically set wasbillpaid false. this creates boolean column in parse.com backend. here code. when adapter loaded, want check if boolean t or f. if (parseconstants.key_creditor_bill_paid.equals(true)){ holder.billpaid.setvisibility(view.visible); holder.billnotpaid.setvisibility(view.gone); } else { holder.billpaid.setvisibility(view.gone); holder.billnotpaid.setvisibility(view.visible); } now, error here. parseconstrants.key_creditor_bill_paid holds value string. parseconstrants class. public static final string key_creditor_bill_paid = "wasbillpaid"; i have 2 icons overlapping. when activity loads, want check see wasbillpaid variable if true or false. when tap imageview control outcome of loading in parse.com the below code onclicklisteners , adjust parseco...