Posts

Showing posts from August, 2012

c++ - LevelDB TEST_ Prefix for Methods -

i'm reading through code in leveldb , keep running across test_ prefix that's used. expect test_ indicates method used tests able operate on internals wouldn't otherwise public. such, i'd expect none of in critical paths. i'd expect them in none of primary methods. however, test_compactrange example called compactrange apart of main compaction path. test_ prefix mean, , can find info? the authors seem use test_ prefix public methods not intended part of api. methods public make testing easier, , prefixed test_ discourage users calling them. why shouldn't these methods appear in critical paths? private methods, visible testing. other thoughts: i'm not sure whether naming convention best practice. c++ has friend declarations accomplish similar. the naming convention similar java guava library's @visiblefortesting annotation edit: clear, i'm making guess based on handful of methods test_ prefix. grepping codebase shows such...

javascript - Explain the encapsulated anonymous function syntax -

summary can explain reasoning behind syntax encapsulated anonymous functions in javascript? why work: (function(){})(); doesn't: function(){}(); ? what know in javascript, 1 creates named function this: function twoplustwo(){ alert(2 + 2); } twoplustwo(); you can create anonymous function , assign variable: var twoplustwo = function(){ alert(2 + 2); }; twoplustwo(); you can encapsulate block of code creating anonymous function, wrapping in brackets , executing immediately: (function(){ alert(2 + 2); })(); this useful when creating modularised scripts, avoid cluttering current scope, or global scope, potentially conflicting variables - in case of greasemonkey scripts, jquery plugins, etc. now, understand why works. brackets enclose contents , expose outcome (i'm sure there's better way describe that), such (2 + 2) === 4 . what don't understand but don't understand why not work equally well: function(){ alert(2 + 2); ...

c++ - Why can templates only be implemented in the header file? -

quote the c++ standard library: tutorial , handbook : the portable way of using templates @ moment implement them in header files using inline functions. why this? (clarification: header files not only portable solution. convenient portable solution.) it not necessary put implementation in header file, see alternative solution @ end of answer. anyway, reason code failing that, when instantiating template, compiler creates new class given template argument. example: template<typename t> struct foo { t bar; void dosomething(t param) {/* stuff using t */} }; // somewhere in .cpp foo<int> f; when reading line, compiler create new class (let's call fooint ), equivalent following: struct fooint { int bar; void dosomething(int param) {/* stuff using int */} } consequently, compiler needs have access implementation of methods, instantiate them template argument (in case int ). if these implementations not in header, wouldn...

c - How to create an array of size 2^16 blocks consisting of 256 bytes -

so title says all. have create file system simulation operating systems class. still not c why asking help. , 1 of things throwing me off have create storage array of 2^16 blocks of 256 bytes each; block plain sequence of bytes until overlaid structure (use union, of course): directory or file meta-data, index node, or data node; there type of node: this did #include "project1task3.h" int main() { createfilesystem(); } /* * create file system * (i.e., allocate , initializing structures , auxiliary data; * create superblock) * * * */ void createfilesystem() { // setting file system "superblock" fs_node filesystem; node typenode; node* p; // pointer point file or director //typenode.type = dir; int i; int j; size_t nodesize; // allocate space fixed sie , variable part (union) nodesize = sizeof(fs_node) + sizeof(node); if ((memory = malloc(nodesize)) == null) { for(i = 0; < mem;i++) ...

forms - Emberjs live serverside validation -

i've managed input going server, , server responding if input valid, or returning error object if not. i'm not sure how use returned error object something. there many examples around internet of how loop through error object , display message isn't i'm after. i have form component has bunch of fields like: {{input type="text" value=account.twitterid class="input" focus-out="validateinput"}} and validateinput in component looks like validateinput() { let account = get(this, 'account'); account.save().then(() => { console.log('success!'); // add class input field }).catch((adaptererror) => { console.log(account.get('errors')); // add different class input field console.log(adaptererror); }); }, as mentioned above, triggers , either returns successful or error message but how take result , use add classes class key of input field? i did attempt following haserror: fals...

visual studio 2015 - How to deploy Service Fabric application services to different Virtual machines scale sets -

i see possible create different nodes per cluster. every node set virtual machine scale set. created cluster 2 nodes set, 1 frontend, other backend (more nodes , more powerful machines). i have service fabric application 3 services. want 1 service deployed on frontend scale set , other 2 backend set. how do visual studio 2015? if right click application , deploy, deploy successful how specify service deployed where? have @ placement constraints. using these, can influence services run. more info here . paragraph: placement constraints , node properties

php - How to cache the application configs in memory in Zend Framework 2? -

one of must-haves performance optimization of zend framework 2 application caching of configurations. idea merge them 1 big config file (or 2 files, e.g. module-classmap-cache.php , module-config-cache.php ), config files don't need opened , merged on every request. (see info in official documentation , how-to in article of rob allen " caching zf2 merged configuration "): application.config.php return [ 'modules' => [ ... ], 'module_listener_options' => [ ... 'config_cache_enabled' => true, 'config_cache_key' => 'app_config', 'module_map_cache_enabled' => true, 'module_map_cache_key' => 'module_map', 'cache_dir' => './data/cache', ], ]; i'd optimize bit more , load configs in-memory cache (e.g. apcu). provided framework? or have write functionality myself? the caching mechanis...

Writing to a file in python -

i have been receiving indexing errors in python. got code work correctly through reading in file , printing desired output, trying write output file. seem having problem indexing when trying write it. i've tried couple different things, left attempt commented out. either way keep getting indexing error. edit original error may caused error in eclipse, when running on server, having new issue* i can run , produce output .txt file, prints single output with open("blast.txt") blast_output: line in blast_output: subfields = [item.split('|') item in line.split()] #transid = str(subfields[0][0]) #iso = str(subfields[0][1]) #sp = str(subfields[1][3]) #identity = str(subfields[2][0]) out = open("parsed_blast.txt", "w") #out.write(transid + "\t" + iso + "\t" + sp + "\t" + identity) out.write((str(subfields[0][0]) + "\t" + str(subfields[0][1]) + "\t" + str(subfiel...

java - Trying to return true if all the letters in a string are the same -

what have far: public boolean allsameletter(string str) { (int = 1; < str.length(); i++) { int charb4 = i--; if ( str.charat(i) != str.charat(charb4)) { return false; } if ( == str.length()) { return true; } } } please excuse inefficiencies if any; still relatively new coding in general. lacking knowledge in terms of using operators , .charat() together? illogical? or error elsewhere? you can follow below steps: (1) first character (i.e., 0th index) (2) check first character same subsequent characters, if not return false (and comes out method) (3) if chars match i.e., processing goes till end of method , returns true public boolean allsameletter(string str) { char c1 = str.charat(0); for(int i=1;i<str.length;i++) { char temp = str.charat(i); if(c1 != temp) { //if chars not match, //just return false here itself, //there no n...

sass - Multi-line Scss indentation in WebStorm -

does know of way webstorm indent following default stylelint guidelines properly? specifically, i'm having issue scss indentation of transforms multiple properties. recommended pattern is: .class-name { transition: transform 100ms ease-out, opacity 10ms linear 90ms; } however, can't webstorm support @ all. when auto-indent code turn above into: .class-name { transition: transform 100ms ease-out, opacity 10ms linear 90ms; } any on great. reference, i'm using following version of webstorm: webstorm 2016.3 build #ws-163.7743.13, built on november 8, 2016

oop - Java Method return Types from Inheritance -

i'm writing method in class parent returns set of object a . however, have class child (inheriting form parent ). want return set of object b ( b inheriting a ). more specifically, methods looks (it throws compile errors right now). parent class method: public abstract <t extends a> set<t> getset(); child class (extends parent class) method: public <t extends b> set<t> getset() {...} is possible this, or not make sense? first of all, let me explain why code not compile. basically, if have class {} , class b extends {} set<b> not sub-type of set<a> . if parent method returns set<a> , override must return same thing. set<b> completely different type . likewise, set<t extends b> not sub-type of set<t extends a> . full explanation found in java docs . the closest solution can think of, uses wildcards: class {} class b extends {} abstract class parent { abstract set<? extends...

python - permutations with unique values -

itertools.permutations generates elements treated unique based on position, not on value. want avoid duplicates this: >>> list(itertools.permutations([1, 1, 1])) [(1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1), (1, 1, 1)] filtering afterwards not possible because amount of permutations large in case. does know of suitable algorithm this? thank much! edit: what want following: x = itertools.product((0, 1, 'x'), repeat=x) x = sorted(x, key=functools.partial(count_elements, elem='x')) which not possible because sorted creates list , output of itertools.product large. sorry, should have described actual problem. class unique_element: def __init__(self,value,occurrences): self.value = value self.occurrences = occurrences def perm_unique(elements): eset=set(elements) listunique = [unique_element(i,elements.count(i)) in eset] u=len(elements) return perm_unique_helper(listunique,[0]*u,u-1) def...

VBA for overlaying a smaller table Drop Down list -

here following vba , works ok: - have couple of tables , used named ranges each of them. - then, on different tab (where code is) have 2 drop down lists users of excel report can select table (only 1 @ time) want display data for. the problem me if select table drop down has 30 rows looks fine - table destination cell a2. if select table has 10 rows, new table 10 rows overlaid on previous 30 row table 20 rows(remaining 30 row table) under 10 row table still there. my question is: how should change code below 20 rows previous table not appear when 10 rwo table selected drop down list? let me know if above doesn't make sense..thanks v much. my code @ minute follows: private sub worksheet_change(byval target range) dim tablename string dim tablerange range dim typeofcosts string application.enableevents = false if range("b1").text = "fixed staff costs" typeofcosts = "_fixed_staff" elseif range("b1")...

javascript - Not able to get result of Angularjs being displaying as expression in html page -

i newbie in angularjs , trying work on google maps application using angularjs. able generate expected results apart 1 thing. when included {{loc.co1}} printed table column. not showing result , giving null. searched lot , found appraoch correct. results available in javascript when accessing html, dont show up. please me this. the input when drawing rectangle on map , click on submit, coordinate values should go table. also, below link of work did. sorry not following format properly. http://plnkr.co/edit/kh5cujabvg2rpjuebgyt?p=info ===========code =================== <!doctype html> <html lang="en"> <head> <meta charset="iso-8859-1"> <title>scientist entry map</title> <link rel="stylesheet" href="scientistmappage.css"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha384-3ceskx3iaeniogmqchp8opvby3mi7ce34nwjpbiwvthfgywqs9jw...

routing - Using middleware in Laravel 5.3 -

i'm attempting create middleware in laravel 5.3 checks see if user admin can restrict routes admins only. my middleware: <?php namespace app\http\middleware; use closure; class isadmin { /** * handle incoming request. * * @param \illuminate\http\request $request * @param \closure $next * @return mixed */ public function handle($request, closure $next) { if( !\auth::user()->hasrole('admin') ) { return redirect('login'); } return $next($request); } } i register in kernal, adding ti protected below: protected $routemiddleware = [ .... 'isadmin' => app\http\middleware\isadmin::class, ] then try secure route with: route::resource('user', 'usercontroller')->middleware('isadmin'); but error route file: fatalthrowableerror in web.php line 103: call member function middleware() on null you should apply middleware ::group() : route...

vb.net - Killing Two different Processes With VB -

i trying figure out how kill 2 processes @ same time have managed 1 work when opened other wont close. sub block() each item process in process.getprocesses if item.processname = "taskmgr" , item.processname = "cmd" item.kill() end if next end sub as noted @noodles , @zaggler logic wrong on line; if item.processname = "taskmgr" , item.processname = "cmd" this line asks if process name "taskmgr" , if same process name "cmd". since these 2 strings aren't same "taskmgr" /= "cmd" if clause never true. suggest this; sub block() each item process in process.getprocesses if item.processname = "taskmgr" item.kill() elseif item.processname = "cmd" item.kill() end if next end sub or optionally if plan close many processes; 'declare @ form loading or elsewhere dim proclist new list (of string) p...

webserver - How do I run a Python script on my web server? -

i've started learning python, , i'm pretty lost right now. want run script on server hosted through hosting24.com. faq says support python, have no clue put script run. there folder called cgi-bin in root, i'm guessing put script? can explain me how works? very simply, can rename python script "pythonscript.cgi". post in cgi-bin directory, add appropriate permissions , browse it. this great link can start with. here's one. hope helps. edit (09/12/2015) - second link has long been removed. replaced 1 provides information referenced original.

node.js - How do I write a shell script using node to run multiple javascript files one after the other? -

i want write .sh file run multiple javascript files. i know need following lines: #!/usr/bin/env node chmod u+x ./a/file1.js ./a/file2.js is correct put 2 .js files 1 after other? need file1.js execute first , file2.js because of functions file2.js need information outputted file1.js. i'm bit confused difference between #!/usr/bin/env node , #!/usr/bin/env bash. still able run .js files bash? #!/usr/bin/env node sets environment node.js javascript environment. for example if create simple script test.js following content: #!/usr/bin/env node // we're in javascript! var d = new date(); console.log('current time: ' + d); afterwards make executable: $ chmod u+x test.js then can execute in shell: $ test.js current time: sun nov 13 2016 07:14:15 gmt+0000 (gmt) the file extension doesn't matter: $ mv test.js test.sh $ test.sh current time: sun nov 13 2016 07:15:05 gmt+0000 (gmt) if don't want change javascript files become sh...

C++ Program To Find Smallest and Largest Number In Array -

beginner in c++ here , learning arrays. program below supposed return smallest , largest number in array using 2 separate functions. 1 largest , 1 smallest number. however, returning 0 time function lastlowestindex , unsure may doing wrong. could ever kindly advice , show me incorrect in function , can done correct returns correct value? not seeing and/or understanding incorrect. thank , time in advance!!! #include <iostream> #include <cstdlib> int lastlargestindex(int [], int); int lastlowestindex(int [], int ); using namespace std; int main() { const int n = 15; int arr[n] = {5,198,76,9,4,2,15,8,21,34,99,3,6,13,61}; int location; //int location2; location = lastlargestindex( arr, n ); cout << "the last largest number is:" << location << endl; location = lastlowestindex(arr, n); cout << "the last smallest number is:" << location << endl; // std::system ("pause"); ...

python 2.7 - Write a function to draw a cobweb plot of fixed point iteration -

i have following code draw cobweb function: def cob_plot(f,x0,n): xvals = [0]*(n+1) xvals[0] = x0 jj in range(1,n+1): xvals[jj] = f(xvals[jj-1]) plt.scatter(xvals[0:n],xvals[1:]) plt.scatter(xvals[1:],xvals[1:]) kk in range(1,n): plt.plot([xvals[kk-1],xvals[kk]],[xvals[kk],xvals[kk]] plt.plot([xvals[kk],xvals[kk]],[xvals[kk],xvals[kk+1]] plt.xlabel("$x_{n-1}$") plt.ylabel("$x_{n}$") i need modify code function: cobweb(f, x0, n, xmin, xmax, ymin, ymax) so cobweb works on function. example: cobweb(cos, 1, 200, 0, 1.5, 0, 1) any suggestions or opinions on how modify code? using python 2.7

php - Display error of specific forms -

Image
i have 2 forms on page (a blade template). want display form errors use: @if (count($errors) > 0) <div class="alert alert-danger"> <ul> @foreach ($errors->all() $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif now have errors on both forms: you can use laravel validation error. throw specific error in specific field. have use in every input control. @if ($errors->has('input_name'))<p class="text-danger"> {!!$errors->first('input_name')!!}</p>@endif

java - How to pass multiple variables from one Activity to another Activity -

how pass multiple variables 1 activity activity? public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button save = (button) findviewbyid(r.id.button1); save.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { // edittext id edittext inputtxt_1= (edittext) findviewbyid(r.id.edittext1); edittext inputtxt_2=(edittext)findviewbyid(r.id.edittext2); edittext inputtxt_3=(edittext)findviewbyid(r.id.edittext3); edittext inputtxt_4=(edittext)findviewbyid(r.id.edittext4); // store edittext in variable string str1 = inputtxt_1.gettext().tostring(); string str2 = inputtxt_2.gettext().tostring(); string st...

ruby on rails - Upload file to remote URL (etc. another LAN computer) with CarrierWave -

Image
my project @ school create demo distributed system. created web app upload , share files (sth small dropbox system). in project, setup 1 virtualbox machine each part. in rails app, i'm using carrierwave gem save uploaded files. follow carrierwave doc here, have 2 options: 1 store files locally in public folder, or use 3rd party storage s3 ... problem here don't know how make carrierwave save files to storage machine (the bottom part).

php - Save PDF by name from Database -

i saving records pdf want them saved using name_empnumber abc_123 i using code below , library tcfpdf if (isset($_post['submit'])){ require_once 'includes/practice.php'; //practice.php using library tcfpdf $pdf->setfont('times', '', 15); $tb1 = '</br></br> <b>2- printer:</b><br /><br /> <table cellspacing="0" cellpadding="0" border="1"> <tr style="background-color:#f7f7f7;color:#333; "> <td width="300">sn</td> <td width="300">type</td> </tr> </table>'; $result= mysql_query("select * accessories emp_number='".$emp_number."' && is_ac...

Error message in Java after extending JFrame -

i'm having trouble snippet of code working on. extending jframe in class contains main method. sort of new java (learned in university, have practice it, still stuck). have return type in locate method ide, eclipse neon, saying convert component. here code: import javax.swing.jframe; public class board extends jframe { /** * */ private static final long serialversionuid = 1l; boolean result; int counter2; int counter = 100000; point point = new point(1,2,3); int to_be_changed = 100000; point[] point2 = new point[100000]; private int fortree = 0; public static void main(string[] args) { board bb = new board(); int colchange = 1; bb.add(1 ,0 ,1); new work(bb); } public void add(int xco, int yco, int colr) { point2[point2.length - counter] = new point(xco, yco, colr); counter--; counter2++; } public boolean filled(int x1, int y1) { int = 0; do{ if (i > 100000){ = 0; } result = ((point2[i].get...

php - How to continuously watch a directory for the presence of files with a certain file-extension? -

for example, want continuously monitor directory presence of .xml files. as .xml file found in directory, program should start processing on file, e.g. reading data inside file, extracting useful data , further actions. solution tried use: i tried use infinite while loop continuously monitor directory, , used glob() check presence of files .xml extension. glob() returns array paths of files found. so within infinite while loop, check if array returned glob() non-empty. if yes, read file @ each path in array returned glob() , appropriate processing on file. the problem when run it, fatal error: maximum execution time of 30 seconds exceeded in c:\xampp\htdocs\alpha\index.php on line 9 i believe due infinite while loop. questions: is way of solving problem way? what should bypass above error? as example of using sse achieve stated intention of monitoring directory the php script directory scans - in example simple glob more sophisticated using...

finding the path of place that error happened in C# pages -

i want put method in catch {} send error ".log" file. put address of page , method error happened their. want me , tell me how can define "strerrorpath" , put on of method input . public static void senderrortopersonalerrormessage(exception ex,string strerrorpath ) { string strerrormessage = string.format("error:{0} time:{1:yyy/mm/dd - hh:mm:ss},address:{2}", ex.message, system.datetime.now, strerrorpath); system.io.streamwriter ostreamwriter = null; string strpersonalerrormessagepath = "~/app_data/log/personalerrormessage.log"; string strpersonalerrormessagepathname = httpcontext.current.server.mappath(strpersonalerrormessagepath); ostreamwriter = new system.io.streamwriter(strpersonalerrormessagepathname, true, system.text.encoding.utf8); }`enter code here` just use ex.source , ex.stacktrace show useful information exception. you can read more stacktrace here

algorithm - a program to apply the following transformation function to a grayscale image -

Image
i want apply following transformation function grayscale image, know how apply following function, my question how apply program following transformation function, code far, clear; pollen = imread('fig3.10(b).jpg'); u = double(pollen); [nx ny] = size(u) nshades = 256; r1 = 80; s1 = 10; % transformation piecewise linear function. r2 = 140; s2 = 245; = 1:nx j = 1:ny if (u(i,j)< r1) uspread(i,j) = ((s1-0)/(r1-0))*u(i,j) end if ((u(i,j)>=r1) & (u(i,j)<= r2)) uspread(i,j) = ((s2 - s1)/(r2 - r1))*(u(i,j) - r1)+ s1; end if (u(i,j)>r2) uspread(i,j) = ((255 - s2)/(255 - r2))*(u(i,j) - r2) + s2; end end end hist= zeros(nshades,1); i=1:nx j=1:ny k=0:nshades-1 if uspread(i,j)==k hist(k+1)=hist(k+1)+1; end end end end plot(hist); pollenspreadmat = uint8(uspread); imwrite(pollenspreadmat, 'pollenspread.jpg'); thanks in advance the figure says intensities between a , b , should set c . have modify 2 for loops values betwee...

python - How to update session object -

with 2 <a> : <a id="100" onclick="createtriggered(this.id)"<i></i> click link </a> <a id="200" onclick="createtriggered(this.id)"<i></i> click link </a> both linked same onclick javascript function: <script type=text/javascript> $script_root = {{ request.script_root|tojson|safe }}; function onclick(id){ var data = $.getjson($script_root + '/triggered', {a:id} ); window.alert({{ "session.keys()" }}); } </script> this javascript function takes clicked <a> id , sends flask function: @app.route('/onclick') def onclick(): session['a_id'] = request.args.get('a') return ('ok') after flask function gets id updates session object creating new key session['a_id'] . finally javascript window.alert used check if session object has new 'a_id' key should set flask function. when w...

c - Why isn't my code accurate when I change the numberOfTerms? -

#include <stdio.h> double pi = 3.141592653589; int numberofterms = 5; int factorial(int n) { if(n > 1) return n * factorial(n - 1); else return 1; } double degreestoradian( double degrees ) { return degrees * pi / 180; } void cosine(double cos){ int x = 0; double ans = 1; int exponent = 2; int isplus = 0; for(x; x < numberofterms - 1; x++){ if(isplus == 0){ ans -= (pow(cos, exponent))/factorial(exponent); exponent += 2; isplus = 1; }else{ ans += (pow(cos, exponent))/factorial(exponent); exponent += 2; isplus = 0; } } printf ("%.12f \t", ans); } void sine(double sin){ int x = 0; double ans = sin; int exponent = 3; int isplus = 0; for(x; x < numberofterms - 1; x++){ if(is...

c# - Antlr parser StackOverflowException -

i have following in antlr parser grammar xamarin.ios c# project: mathtoken : digit #digit | null #null | lessthan #lessthan | greaterthan #greaterthan | anylessthanorequal #lessthanorequal // 30 more options here mathtokenlist : mathtoken mathtokenlist #compoundmathtokens | mathtoken #singlemathtoken ; this works great list of 10 tokens, 100, or 1000. once list gets long enough, leads stackoverflowexception, generated mathtokenlist recursively calls itself, listener code @ top: mynamespace.handletoken(mytokenclass parsertoken, list<myothertokenclass> buildinglist) in mynamespace.manualfileparser.cs:58 mynamespace.customstringreaderparselistener.visitdefault(antlr4.runtime.tree.terminalnodeimpl node) in mynamespace.customstringreaderparselistener.cs:228 mynamespace.customstringreaderparselistener.visitterminal(antlr4.runtime.tree.terminalnodeimpl node) in mynamespace.cu...

bash - Build scripts with command delay -

im using in command line 3 commands , since i'm doing on , on again want build script, problem following : this im doing 1 . cd users/home/d56789/tmp - > tar czf ../fts/runnerer.tar app/ this take 2 sec 2 . cd users/home/d56789/fts - > cf update-run mybp -p /home/d56789/fts/ -i 4 this take 8 sec cd users/home/d56789/myapp -> cf push this take 30 sec my question how can build script can commands 1 after other needed delay between them ? commands executed in sequence. example tar command in question, while it's running, cannot start running else. have wait complete. as such, can list commands want in script, , executed 1 after another. doesn't matter if 1 commands takes 2 seconds or 22, next command not run until previous completed. set -e cd users/home/d56789/tmp tar czf ../fts/runnerer.tar app/ cd ../fts cf update-run mybp -p /home/d56789/fts/ -i 4 cd ../myapp cf push i added set -e @ top safety. is, if of commands fail...

Berlin 10.1 IOS SSL Get with NetHTTPClient & NetHTTPRequest -

trying work out why when need access ssl websites using the default nethttp & nethttprequest keep getting data error in ios when ever functions (nethttprequest1.execute().contentasstring(); called) works fine in windows 32 , do need load kind of open ssl files ios device, trying avoid this, seems native code below not require deploy files allow iohandler work ssl websites, great. nethttprequest has client of nethttpclient , dropped on visual form, tried create method, same result. var html:string; begin nethttprequest1.url:='http://www.example.com'; html:=nethttprequest1.execute().contentasstring(); memo1.text:=html; end; // end of procedure

php - How to send the user to a new URL? -

this current url . i've had new project time , wondering if: there way when user clicks gadgets sends him .... cat=gadgets , , remembers previous selections how can transform awful looking dropdown list more appealing radio or 2 basic buttons. my code: <div id="advanced-search"> <form action="<?php bloginfo('url');?>/recipes" method="get" id="searchf1"> <?php $searched_term = get_query_var('recipe_search'); if (empty($searched_term)) { $searched_term = isset($_get["search"]) ? $_get["search"] : ""; } ?> <input id="sfield" type="text" name="search" placeholder="keywords" <?php if (!empty($searched_term)) {echo 'value="'.$searched_term.'"';} ?>> <select id="img" name="images"> ...

c++ - cloud 9 execute thread -

i running code in c++ on c9 , getting error: terminate called after throwing instance of 'std::system_error' what(): enable multithreading use std::thread: operation not permitted. although file compile after adding command line -wl,--no-as-needed , -lpthread, run function on cloud 9 still response same error ` try run on bash , it's working still want run regular run function(known f5) able use debugger here example of code: #include <iostream> #include <thread> void foo() { // stuff... } void bar(int x) { // stuff... } int main() { std::thread first (foo); // spawn new thread calls foo() std::thread second (bar,0); // spawn new thread calls bar(0) std::cout << "main, foo , bar execute concurrently...\n"; // synchronize threads: first.join(); // pauses until first finishes second.join(); // pauses until second finishes std::cout << "foo , bar...

cmake - Can't run ctest unless the test executable is named "tests" -

i trying cmake/ctest work. problem ctest not seem pick test executable unless named tests . in minimal example project have single cmakelists.txt file: cmake_minimum_required(version 3.0) project(myproject c) enable_testing() set(test_exe_name tests) add_executable(${test_exe_name} test_main.c) add_test(name "my tests" command ${test_exe_name}) ...and simple test program, test_main.c , passes: int main() { return 0; } i can run make && make test , , fine long test_exe_name set tests . however, when change executable name else, e.g. mytests , following error: could not find executable tests looked in following places: tests tests release/tests release/tests debug/tests ... what missing? according cmake manual add_test() test name may not contain spaces: the test name may not contain spaces, quotes, or other characters special in cmake syntax. in problematic example, test named "my tests". changing test name "my_tests...

objective c - iOS project:Why the long press gesture is so easy to be triggered? -

Image
just title says, when update xcode8, in project, long press gesture easy triggered, when tap screen, call up! , keyboard have problem. when type word, xcode print infomation follow: [uiwindow enddisablinginterfaceautorotationanimated:] called on <uiremotekeyboardwindow: 0x100ffb940; frame = (0 0; 414 736); opaque = no; autoresize = w+h; layer = <uiwindowlayer: 0x17042d700>> without matching -begindisablinginterfaceautorotation. ignoring. and in view, add tap gesture , longpress gesture, when tap(just touch), gesture triggered longpress, not tap gesture. problem have'not searched anywhere, come here ask help. (forgive me, terrible on english) i post 2 pictures can know clearly. this code: uilongpressgesturerecognizer * lp = [[uilongpressgesturerecognizer alloc] initwithtarget:self action:@selector(lp:)]; lp.minimumpressduration = 1.0f; [_imageview addgesturerecognizer:lp]; - (void)lp:(uilongpressgesturerecognizer*)lp { if (lp.state == uigesturerecog...

silverlight 5.0 - DBDomainService & DbContext RIA Class Library -

i using ef5, silverlight, ria service in project. i have ria class library project (with 2 projects), have setup correctly other sl projects class library. i created .edmx in ria .web project database , got following class generated: public partial class scentities : dbcontext { public scentities() : base("name=scentities") { } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { throw new unintentionalcodefirstexception(); } public dbset<period> periods { get; set; } public dbset<user> users { get; set; } } in client sl application, can't reference dbcontext class (scentities). i created domainservice class in ria class .web project inherit dbdomainservice follows: public partial class scdomainservice : dbdomainservice<scentities> { } i go sl application & can reference scdomainservice no problem. why can not reference or access scentities (dbcontext) ? is ri...

dynamics crm 2011 - how to check an empty field using Enable Rules in visual ribbon editor -

i'm trying change button enable rules according value rule using visual ribbon editor. rule - if field empty button disabled, insert data visual ribbon editor : enable rules - field: myfieldname value:"" //i tried null instead of "", didn't work default:false invert result:true the output is: buttons act same if field empty or not... missing ? it should null instead of null https://ribbonworkbench.uservoice.com/knowledgebase/articles/121427-enable-disable-a-ribbon-button-dynamically-based-o

java - Custom Font not working in Fragment Android Studio -

i wanted make custom font textview. i've got in fragearncredits.java: public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { super.oncreate(savedinstancestate); if (aiview == null) { aiview = inflater.inflate(r.layout.fragment_earn_credits, container, false); } t = (textview) aiview.findviewbyid(r.id.logo); typeface mycustomfont=typeface.createfromasset(aicontext.getassets(),"fonts/bebas.otf"); t.settypeface(mycustomfont); in fragment_earn_credits.xml : <textview android:id="@+id/logo" android:text="fashion wallet" android:gravity="center" android:textsize="40dp" android:textcolor="@color/md_brown_700" android:layout_margintop="100dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop=...

node.js - How to perform an async operation on exit -

i've been trying perform asynchronous operation before process terminated. saying 'terminated' mean every possibility of termination: ctrl+c uncaught exception crashes end of code anything.. to knowledge exit event synchronous operations. reading nodejs docs found beforeexit event async operations : the 'beforeexit' event not emitted conditions causing explicit termination, such calling process.exit() or uncaught exceptions. the 'beforeexit' should not used alternative 'exit' event unless intention schedule additional work. any suggestions? you can trap signals , perform async task before exiting. call terminator() function before exiting (even javascript error in code): process.on('exit', function () { // cleanup such close db if (db) { db.close(); } }); // catching signals , before exit ['sighup', 'sigint', 'sigquit', 'sigill', 'sigtrap...

python - Comparing sublists and merging them -

i have list contains lot of sublists, pairs of numbers, looks like: list = [[2, 3], [4, 5], [7, 8], [8, 9], [11, 12], [14, 15], [15, 16], [16, 17], [17, 18], [18, 19], [20, 21]] and want compare last digit of sublist first digit in next sublist , if match - merge them in 1 sublist. output 2 matching sublists that: output = [[7, 8, 9]] and, of course, if there row of matching sublists merge them in 1 big sublist. output = [[14, 15, 16, 17, 18, 19]] i thinking using itemgetter kind of key compare. like: prev_digit = itemgetter(-1) next_digit = itemgetter(0) but realised don't understand how can use in python, due lack of knowledge. tried think of loop, didn't work out didn't know how implement "keys". for kind of inspiration used python, comparison sublists , making list still have no solution. also, list can kinda big (from human perspective, thousand pairs or stuff) i'm interested in efficient way this. and yes, i'm new python, g...

apache make access file only internally -

first, not @ english. when using nginx: erorr_page 404 /404.html; after restart, request server.com/404.html return 200 ok way should. other files return 404 error if file not exists. then edit this: error_page 404 /404.html; location = /404.html { internal; } server.com/404.html page return 404. other files return 404 correctly if file not exists. it not 404 page. 500 internal error page return 200 when access directly. even php files can use internally. rewrite ^/index$ /index.php; location ~ \.php$ { internal; fastcgi_pass 127.0.0.1:9000; ... } it make server.com/index returns index.php file server.com/index.php return 404 error. you can find document nginx internal directives @ here: http://nginx.org/en/docs/http/ngx_http_core_module.html#internal how make file use internally using apache htaccess?

java - Android BluetoothGattService - exception cannot marshall -

i have got following problem. my application architecture more or less consits of 3 main parts: devices view (shows available ble devices) ble service (handles ble connections , data) services view (shows services particular device) my issue passing bluetoothgattservice intent second time (first time works). more or less actions this: choose device, want show services send intent device , action perform bleservice bleservice performs service discovery , sends intent services back broadcastreceiver receives intent , wats start new activity using data in received intent. and on last step there problem cannot put arraylist intent/bundle causes exception: e/androidruntime: fatal exception: main process: com.projects.dawid.gattclient, pid: 4133 java.lang.runtimeexception: parcel: unable marshal value android.bluetooth.bluetoothgattservice@ef62956 @ android.os.parcel.writevalue(parcel.java:1337) ...