Posts

Showing posts from March, 2012

maven - What is the best way to read in gradle repository credentials from a properties file? -

it's not clear me logging repository happens in gradle execution/configuration chain i have task loadmyproperties { properties props = new properties() props.load(new fileinputstream(mypropertiesfilename)) myusername = props.getproperty('user') mypassword = props.getproperty('password') } and make compile depend on compilejava.dependson loadproperties however, not @ sure when repositories block repositories { maven { credentials { username myusername password mypassword } url myurl } } is 'executed' compared other tasks, nor when attempts gain authorization specified repository provided credentials. when run gradle build sometimes credentials work, , don't (i 401 authorization error maven server), makes me think not ordering tasks. my thinking loadproperties code happens inside configuration phase (since it's no

xml layout - Android pass parent view's 'pressed' state to child views -

there many question here on asking way prevent child view copying parents pressed or selected states. however, i'm asking other way around here :) - i've seen weird behavior in 1 of apps: when running app on 4.0.4 device (api 15) behavior saw matched apparent default, is: parent forwards state down of child views. when running same app without changes on higher api level (android 4.4) behavior changes: parent not forward state. i introduced duplicateparentstate in xml layout relevant child views, not seem here. is known 'issue' or planned change in behavior api 15 api >> 15? how can make sure states forwarded across api levels? if of / relevance here: subview want duplicate parents state custom imageview adds tintcolors - since behavior correct on 4.0.4 there should not mistakes in class? public class incimageview extends imageview { private int _tintcolor; private int _highlightedtintcolor; private int _selectedtintcolor; pub

Javascript comparisons -

i know why following comparisons in javascript give me different results. (1==true==1) true (2==true==2) false (0==false==0) false (0==false) true i can not figure out why. the tests equivalent these: (true==1) true (false==2) false (true==0) false which equivalent these: (1==1) true (0==2) false (1==0) false in each case == converts boolean number 1 or 0 . first == in each 1 gives initial true/false value, used first operand second == . or put inline: ((1==true)==1) ((1==1) ==1) ((true) ==1) ((1) ==1) true ((2==true)==2) ((2==1) ==2) ((false) ==2) ((0) ==2) false ((0==false)==0) ((0==0) ==0) ((false) ==0) ((0) ==0) false

html - PHP Image from url src returns 403 error and application/octet-stream -

pulling images url when ran never had before. header check returned 403 error , although images extensions listed .jpg returned application/octet-stream, , checking content type returned text/html. i have read 403 "typically" prevent screen scrapping, on images. i found odd view source of web page, see image src, , click on , return image browser, not via code. is there way convert image url actual image? want pull height, width, size info images , save them folder on server. $html = file_get_contents($url); $doc = new domdocument(); $doc->loadhtml($html); $tags = $doc->getelementsbytagname('img'); foreach ($tags $tag){ $image_src = $tag->getattribute('src'); echo get_headers($image_src, 1); //returns 403 forbidden error echo image_type_to_mime_type(exif_imagetype($image_src)); //returns application/octet-stream $i = getimagesize($image_src); var_dump($i); //returns bool(false) $c = curl_init(); curl_setopt($c, curlopt_returntransfer

jQuery Button to check all checkboxes disappers on start -

why button disappearing on start ? want check , uncheck alls checkboxes 1 button. can't solution. <!doctype html> <html> <head> <meta charset="utf-8"> <title>unbenanntes dokument</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $('.check:button').toggle(function(){ $('input:checkbox').attr('checked','checked'); },function(){ $('input:checkbox').removeattr('checked'); }) }) </script> <div id="button"> <input type="button" class="check" value="check all" /> </div> <div id="check"> <input type="checkbox" /> checkbox 1 <input type="che

Unread marks in Xpages views are indented ? Any fix -

Image
put in unread marks in view in xpages , column indented very oddly. searched google , found document: http://www-01.ibm.com/support/docview.wss?crawler=1&uid=swg1lo78976 however, when try log in , see document, can never document open. ibm doesn't have unreads working in xpages??? my apologies. code here: <xp:viewpanel rows="99" id="projectsworking" viewstyle="width:99.0%" rowclasses="oddrow, evenrow" var="viewentry" showunreadmarks="true"> <xp:this.facets> <xp:pager partialrefresh="true" layout="previous group next" xp:key="headerpager" id="pager1"> </xp:pager> </xp:this.facets> <xp:this.data> <xp:dominoview var="projectsw

xml - How to select a value using Xpath -

i new xml , struggling find answer problem. have following code (see below) , extract value 3400.0000000000 it. how do using xpath? <spindlespeed dataitemid="c2" name="sspeed" sequence="351828725" subtype="actual" timestamp="2014-12-01t21:51:32.834494">3400.0000000000</spindlespeed> try : //spindlespeed/text()

gtk - GtkLabel is not wrapping after updating its content -

here code using : messagecrypte= gtk_label_new(""); gtk_widget_set_size_request(messagecrypte, 400, 100); gtk_label_set_line_wrap(gtk_label(messagecrypte), true); gtk_grid_attach(gtk_grid(crypttab), messagecrypte, 0, ++i, 2, 1); when initialize label manually passing string gtk_label_new , text wrapped , when updating gtklabel , increment window size infinite without wrapping, from docs : note setting line wrapping true not make label wrap @ parent container’s width, because gtk+ widgets conceptually can’t make requisition depend on parent container’s size. label wraps @ specific position, set label’s width using gtk_widget_set_size_request(). i did said no results ! the problem in wrap mode , wrapd mode '...word' default that's mean wrap when : (the limit exceeded , there new word) entering string example dont contains space consider 1 word , when setting wrao mode '...char' wrap when : (the limit excee

ios - Multidimensional array of objects bug in swift? -

Image
i have multidimensional (2d) array of items (object) , decided use "natural" way create (so instead of using trick transform 1d array 2d, go 2d directly). an item has x & y position on matrice , item has random type. everything seems work except y position of items... because of how swift handles 2d, needed initialize 2d array affect values correctly each item. i verify value affect items, work. when verify item after has been correctly set, y position unique items. class matrix { var nbcol: int var nbrow: int var items: [[item]] init(nbcol: int, nbrow: int) { self.nbcol = nbcol self.nbrow = nbrow items = array<array<item>>() //initialize col in 0..<int(nbcol) { items.append(array(count: nbrow, repeatedvalue: item())) } //affect correct values each item createitems() } func createitems() { //assign x, y & type values item x i

scala - How to read different lines from a text file simultaneously -

i need read file line line such reads first line, it, takes second line, , on. i know how read text file line line: for(line <- source.fromfile("file.txt").getlines()) { insert(line) **use first line of file in function reverse(line) **use second line of file in function } in insert function, first want use first line of file, , in reverse function want use second line, in second iteration of loop, want use 3rd line in insert function , 4th line in reverse function , on. how that? edit: example. want general thing, suppose if want use first line, second line, third line , iterate loop, how that? using sliding group lines pairs of two. for(pairs <- source.fromfile("file.txt").getlines().sliding(2, 2)) { insert(pairs.head) reverse(pairs.last) } obviously you'll need handle condition don't have list of length.

xml - Get data from geoapi into google spreadsheets -

i'm trying country name given city, here's formula warszawa: =importxml(" http://api.geonames.org/search?q=warszawa&maxrows=1&style=full&username=glebvk ";"/geonames/geoname[1]/countrycode") i "error: imported content empty." change xpath query /geonames/geoname[1]/countrycode /geonames/geoname[1]/countrycode . xpath queries case-sensitive.

python - RESTfully routing an API based on user roles -

i developing api using flask-restful, , application has 3 roles. site_admin department_admin basic for given resource, json object returned has different set of keys based on each role. for example, if hit /orders "site_admin", result this: { "orders": [ {"id": 1, "user": "foo", "paid": true, "department": "a", "code": 456}, {"id": 2, "user": "bar", "paid": false, "department": "a", "code": 567}, {"id": 3, "user": "meh", "paid": false, "department": "b", "code": 678} ] } however, if hit /orders "department_admin", result this: { "orders": [ {"id": 3, "user": "meh", "paid": false} ] } and if hit /orders "basic" minimal json response this: { &

c# - Posting updated Address to the database MVC 5 -

i'm still learning how use mvc 5, , far manage custom fields user profiles seen here in manage view page: http://puu.sh/ddmvy/2533472010.png the user registers , fills out these fields , stored in same place username , password data stored. added these fields right under applicationuser in identitymodels.cs seen here public class applicationuser : identityuser { // additional user fields needed registration public string firstname { get; set; } public string lastname { get; set; } public string address { get; set; } public string city { get; set; } public string state { get; set; } public int zipcode { get; set; } public async task<claimsidentity> generateuseridentityasync(usermanager<applicationuser> manager) { // note authenticationtype must match 1 defined in cookieauthenticationoptions.authenticationtype var useridentity = await manager.createidentityas

json - PUT action on WebApi Controller not saving data to database -

Image
i have simple mvc5 webapi project following models: public class product { public product() { } public int productid { get; set; } public string productcode { get; set; } public int bomid { get; set; } public virtual bom bom { get; set; } } public class bom { public bom() { products = new list<product>(); } public int bomid { get; set; } public string description { get; set; } public int counter { get; set; } public virtual list<product> products { get; set; } } public class appdbcontext : dbcontext { public dbset<product> products { get; set; } public dbset<bom> boms { get; set; } } here put action (the scaffolded action): public ihttpactionresult putproduct(int id, product product) { if (!modelstate.isvalid) { return badrequest(modelstate); } if (id != product.productid) { return badrequest(); } db.entry(product).state = entitys

php - readdir sort by filename where file name is the name of the months -

<?php $current_dir = "/members/downloads/board-meetings/2014/"; // full path directory $dir = opendir($current_dir); // open directory echo (""); while ($file = readdir($dir)) // while loop { $parts = explode(".", $file); // pull apart name , dissect period if (is_array($parts) && count($parts) > 1) { $extension = end($parts); // set see last file extension if ($extension == "pdf" or $extension == "pdf") // pdf docs extention echo "<li class=\"pdf\"><strong><a href=\"/members/downloads/board-meetings /$file\" class=\"underline\" target=\"_blank\">$file</a></strong></li>"; // if so, echo out! } } echo "<br>"; closedir($dir); // close directory ?> i hoping ask expert. code works great except site needs li

mysql - syntax error near WHERE when trying to find product with names that are different with the same assigned codes -

i have columns in table product named id , name. each row product single product code. i retrieve names , ids of similar-sounding products different codes. know basic structure of such query should in mysql? your last clause should having clause, not clause. using aggregate function on row-level filter. see sql - having vs where

C File Parsing Issue -

i have file read in in format like 3%6%1 5%3%0 4%9%2 i need in format can save separate fields each line, suppose can make typedef something.num1 = 3, something.num2 = 6, something.num3 = 1 here's have far: #define buf 128 #define lines 100 char line[lines][buf]; file *input = null; int = 0; int total = 0; input = fopen("input.txt", "r"); while(fgets(line[i], buf, input)) { /* rid of ending \n fgets */ line[i][strlen(line[i]) - 1] = '\0'; i++; } total = i; printf("original read:\n"); for(i = 0; < total; ++i) { printf("%s\n", line[i]); } printf("\nparsed:\n"); char *token; char parsed[lines][buf]; for(i=0; i<total; i++) { token = strtok(line[i], "%"); while(token != null) { strcpy(parsed[i],token); token = strtok(null, "%"); } } for(i=0; i<total; i++) { printf("%s\n",parsed[i]); } the problem when print out values in parsed arr

javascript - Send data to client page from mysql database without refreshing page (timeout) -

Image
i created tabulation system beauty pageants show judges score on projector. created presentation page using codeigniter. the html presentation page purely written in javascript. page refreshes each second real-time data sent judges. the not-so-cool thing logic when page writes lot of data, page blinks every second. refreshing of page noticeable , disturbing. this snippet of code i'm working on. $(document).ready(function() { getjudgesscore(); setinterval(function(){ if (getnumfinalists() == 0) getjudgesscore(); else { window.open ('presentationfinalists','_self',false) } },1000); }); you can imagine how data being sent , received every time code executed. to sum up, want accomplish instead of client asking data every second, server initiates connection every time new data saved d

javascript - Scroll page to the bottom of a div with jQuery -

i have large div s code samples , i'd add button so, when user clicks on it, page scroll (with ease) bottom of div . body { background-color: #ecf0f1; } .story { background-color: #fff; border-radius: 5px; height: 500px; margin: 20px auto; padding: 10px; width: 70%; } <div class="story"> <button class="scrolltobottom">scroll bottom</button> </div> <div class="story"> <button>scroll bottom</button> </div> <div class="story"> <button>scroll bottom</button> </div> <div class="story"> <button>scroll bottom</button> </div> <div class="story"> <button>scroll bottom</button> </div> <div class="story"> <button>scroll bottom</button> </div> <div class="story"> <button class="scrolltobottom&q

scikit learn - Sklearn OneClassSVM can not handle large data sets(0xC0000005) -

i using oneclasssvm outlier detection. clf = svm.oneclasssvm(kernel='rbf', nu=k, tol=0.001) clf.fit(train_x) however encountered following error. process finished exit code -1073741819 (0xc0000005) the data size around 20mb(train_x), not big me. memory of computer 8gb. if reduce file size, worked. , behavior inconsistent. worked , did not work otherwise. has 1 had problem before? thanks!

c++ - math with ctime and time_t -

does know how todo math ctime? need able time in sec in "time_t" (like does) , subtract set number of seconds before inputting time_t ctime time , date. so calculating date of many sec ago. time_t basic representation of date , time type time_t. value of time_t variable number of seconds since january 1, 1970, call unix epoch. best way internally represent start , end times event because easy compare these values. struct tm while time_t represents date , time single number, struct tm represents struct lot of numbers: struct tm { int tm_sec; /* seconds. [0-60] (1 leap second) */ int tm_min; /* minutes. [0-59] */ int tm_hour; /* hours. [0-23] */ int tm_mday; /* day. [1-31] */ int tm_mon; /* month. [0-11] */ int tm_year; /* year - 1900. */ int tm_wday; /* day of week. [0-6] */ int tm_yday; /* days in year.[0-365] */ int tm_isd

.htaccess - Apache host with multiple alias/domains rewrite rule -

i have apache vhost server , multiple aliases. server being production/live domain , aliases being dev , staging servers. example: servername foo.bar serveralias dev.superfoo.bar serveralias stage.superfoo.bar is there rewrite rule preserve domain, whatever may be, , redirect people domain/en-us/anything domain/en/anything? i believe ^/en-us/(.*)$ foo.bar/en/1$ trick 1 domain. there way preserve domain instead of writing rule every alias? to ensure correct domain retained on each one, may use %{http_host} variable in redirection: rewriteengine on rewriterule ^/en-us/(.*)$ http://%{http_host}/en/$1 [l,r=301] the [r=301] flag issues permanent 301 redirect, in testing may want use 302 since browsers might aggressively cache redirect making hard debug. above used leading / in ^/en-us . necessary if use rule @ virtualhost level. however, if use inside .htaccess file in document root, must not include / , in: rewriteengine on rewriterule ^en-us/(.*)$ http://%{ht

java - For Loop, Int Max -

i beginner in java, can please explain me code means , how comes answer of 15. understand loop not doing int max . int count; int max = 3; (count = 1; count < 7; count++) { max = max + 2; } system.out.println(max); so loops counting loops. can number of times. in case count starts @ 1 , goes until 6 because last run count less 7. in effect amount of max starts @ 3 , has 2 added 6 times, number of times loop runs. hope helps! finished first year of cs, im glad had chance help.

c++ - How to convert strings of 2D array into each char array? -

i taking inputs in 2d-array. i.e-- forward 50 20 i want copy "forward" in simple char array[], "50" in char array[] (each string in each char array[]) i able store first element in first array. i've tried storing index of "space" , storing integer values until "another space "\n" found in 2d-array, stored first string (forward) in char arrays ran loop on... here's code checking on. for (int j=0; arr[1][j] != ' '; j++) { check[m] = arr[1][j]; m++; } check[m] = '\0'; int k = 0; cout << check << endl; if (arr[1][m] == ' ') { (;arr[1][m] == ' ';) { m++; cout << arr[1][m]; value[k] = arr[1][m]; k++; } } value[k] = '\0'; from comments seems though might should c question , not c++ question. but since homework anyway maybe seeing c++11 solution moving in right direction. const char* arr[]{"forwa

javascript - What does `var` do in the global scope? -

this question has answer here: difference between variable declaration syntaxes in javascript (including global variables)? 5 answers in html <script> tag, outside of function, var have meaning? is there difference between these 3 notations? <script> var = 1; b = 1; window.c = 1; </script> at top level (outside functions) var declares global variable. to avert this, wrap code in function. (function () { var = 1; }()); 'a' in window; // => false despite each form declares global variable, have subtle differences. var creates undeletable property on window , , subject typical hoisting rules whereby property exist on window @ start of var statement's execution context. other forms create deletable property on window @ time line of code executed. see this answer more info.

How to implement the favorite functionality in the android gridview -

i'm having app, i'm display information in gridview. need add favorite functionality same gridview. please me this. tried googling, no luck. you can use custom checkbox favorite in gridview items here code checkbox <checkbox android:id="@+id/checkbox_favorite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:button="@drawable/customdrawablecheckbox" android:layout_marginleft="10dp"/> here code custom drawable <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/ic_action_favorite" /> <item android:state_checked="true"

c++ - How to display a two-dimensional string array properly? -

so table making #include <iostream> #include <string> using namespace std; int main() { string tables[5][14] = { { "0", "3", "6", "9", "12", "15", "18", "21", "24", "27", "30", "33", "36", "2 1" }, { "2", "5", "8", "11", "14", "17", "20", "23", "26", "29", "32", "35", "2 1" }, { "1", "4", "7", "10", "13", "16", "19", "22", "25", "28", "31", "34", "2 1" }, { "1st 12", "2nd 12", "3rd 12" }, { "1-10", "even", "red", "black", "odd", "19-36" } }; cout <<

php - Mage registry key "_singleton/core/resource" already exists -

mage registry key "_singleton/core/resource" exists trace: #0 /home/sourceciti/public_html/demo/nrrexports/demo/app/mage.php(223): mage::throwexception('mage registry k...') #1 /home/sourceciti/public_html/demo/nrrexports/demo/app/mage.php(477): mage::register('_singleton/core...', object(mage_core_model_resource)) #2 /home/sourceciti/public_html/demo/nrrexports/demo/app/code/core/mage/core/model/resource/setup.php(141): mage::getsingleton('core/resource') #3 /home/sourceciti/public_html/demo/nrrexports/demo/app/code/core/mage/core/model/resource/setup.php(234): mage_core_model_resource_setup->__construct('core_setup') #4 /home/sourceciti/public_html/demo/nrrexports/demo/app/code/core/mage/core/model/app.php(417): mage_core_model_resource_setup::applyallupdates() #5 /home/sourceciti/public_html/demo/nrrexports/demo/app/code/core/mage/core/model/app.php(343): mage_core_model_app->_initmodules() #6 /home/sourceciti/public_html/demo/

slider - View Pager in android with View Pager indicator Click Event? -

i using this sample code , library .this library working fine swipe screen want when click view pager indicator slide working position. note: this view pager indicator click working in android phone home page. you have set on view of viewpager, this, public class viewpageradapter extends pageradapter { context context; string[] title; string[] image; layoutinflater inflater; arraylist<categories> arraylist; activity activity; public viewpageradapter(context context, arraylist<categories> arraylist) { this.context = context; this.arraylist = arraylist; } @override public int getcount() { // todo auto-generated method stub return arraylist.size(); } @override public boolean isviewfromobject(view view, object object) { // todo auto-generated method stub return view == ((relativelayout) object); } @override public object instantiateitem(viewgroup container, final int position) { // todo auto-generated method stub textvi

Fortify on Oracle codebase -

fortify sca behaviour oracle codebase ( .sql , .trig , .pkg, .syn etc files) not expected : observations : 1) reports 0 issues oracle codebase(s). 2) considers .sql files not other .pkg etc. though introducing com.fortify.sca.fileextensions.pkg = plsql in fortify-sca.properties dint help. still doesnt consider .pkg files. there other step required achieve this? 3) though introducing sql-injeciton code ( https://docs.oracle.com/cd/e38689_01/pt853pbr0/eng/pt/tpcd/task_preventingsqlinjection-0749b7.html ) testing purpose , dint help. doesnt catch problem well. are these known issues ? can please advise. by default, files extension sql assumed t-sql rather pl/sql on windows platforms. if using windows , have pl/sql files sql extension, can configure sca treat them pl/sql rather explicitly specify each time run sourceanalyzer. change default behavior, set com.fortify.sca.fileextensions.sql property in fortify-sca.properties “ tsql ” or “ plsql .”

Row navigation using previous and next button excel form vba -

i have excel form employee data entry work. excel sheet contains details of employees. want form navigate through each record through previous , next button, displaying content in form. i written code not working properly. gives invalid record details while reaching begin , end of records. me private sub userform_initialize() frmempdetails.combogender.additem "male", 0 frmempdetails.combogender.additem "female", 1 counter = activesheet.usedrange.rows.count temp_counter = counter lbltmpcount.caption = temp_counter end sub private sub btnnext_click() status = 1 lbltmpcount.caption = temp_counter if (temp_counter >= counter) msgbox "reached end" else temp_counter = temp_counter + 1 txtid.text = cells(temp_counter, 1).value txtname.text = cells(temp_counter, 2).value txtdob.text = cells(temp_counter, 3).value combogender.value = cells(temp_counter, 4).value txtaboutemp.text = cells(temp_counter, 5).value lbltmpcount.

python - Finding the sum of grouped data by column -

my grouped data looks like: deviceid time total_sent 022009f075929be71975ce70db19cd47780b112f 1980-january 36 4 52 1 94 1 211 1 278 1 318 2 370 1 426 1 430 1 435 1 560 1 674 1

r - Create string with variable names and values for data.table lookup -

i'm trying construct lookup string match values in r data.table. have data.table called mydatatable columns v1:v4 , list called mylist 3 elements c("a", "b", "c"). here's (admittedly inelegant) code: # create first value matchstr <- paste('v1', '=="', mylist[1], '"', sep="") # construct rest of match string (i in 2:length(mylist)) { matchstr <- paste(matchstr, ' & v', i, '=="', mylist[i], '"', sep="") } matchstr <- paste(matchstr, ",", sep="") my match string looks this: matchstr [1] "v1==\"a\" & v2==\"b\" & v3==\"c\"," if use cat output string, looks this: cat(matchstr) v1=="a" & v2=="b" & v3=="c", i want use lookup string data.table, this: mydatatable[v1=="a" & v2=="b" & v3=="c",]

angularjs - I am trying to creating a polling app on the mean stack. I think my routing is messed up but I am not sure -

i trying create polling app described in tutorial here . i have step 2 finished, , start step 3(once application running properly) incorporate db portion. application not behaving application listed in tutorial though. i have scanned code numerous times , debugged , still cant seem catch throwing off. when run application runs fine, none of partials being displayed provided in inital index.html view, showing blank navbar. i have provided git repository . if has moment , can take @ it. thank time in advance. some of key things fixed in pull request : you need include angular-route.js separate file now, , have module depend on ngroute . you missing quotes around first $routeprovider in following line: .config(['$routeprovider',function($routeprovider){ you need register controllers using name (string) module, rather using global functions. app.controller('controllername', function ($scope, ...) { ... }); you forgot reference few of js files

php - WordPress files downloading instead of executing on the server -

my wordpress files downloading instead of executing on server. have tried changing server not solve issue. sure happening wordpress files hosting runs other wordpress files smoothly. i wish could provide code isn't needed. please guide me. thanks. i have seen happen when: 1) php turned off or not installed on server 2) server needs reset 3) file names not correct 4) redirect script not redirecting should 5) links not valid the news of these can solved you/your host. call host ask them on verifying php install/process. if (for instance, if have site on same server working fine) need verify file names. wordpress , file names pretty standard isn't make sure there no unwanted spaces , file names "something.php". wordpress may see bunch of parameters passed through url "something.php?blah=blah" fine (no space between php , ?). check link clicking. file names might link may bad. might simple fixing link urls. recall of wordpress, there

angularjs - Actual role of WEB-INF in a java web application? -

i creating web application using java, spring, hibernate , angularjs. not understand role of web-inf directory. per know web-inf web directory keep our web configuration files. have seen example in angularjs app js , html put in web-inf folder , known web-inf not publicly accessed. why put files in web-inf , mean of publicly accessed when response request html , js visible clients, , if put in web-inf folder these files how access files. i need clarification on these few points before starting app development. please can me regarding these issues. as said, put configuration files web-inf folder. there cases when use resource files (e.g. html templates) not sent client as-is, transformations or parameter substitution happens, handled servlet . it ok put such templates , resources web-inf folder because files should not visible/accessible clients result of transformations/parameter substitutions.

ios - How to convert .pem to .pfx? -

i working push notifications .i downloaded required certificate csr , ssl certificates things , converting .pem format webservices team providing services in asp.net need convert .pem format .pfx format.how can thing using following commands , links. not working me openssl pkcs12 -export -in certificates.cer -inkey key.pem -out certificates.pfx -certfile ca.cer and follow these link got error. https://support.servertastic.com/convert-pem-to-pfx/ i have these files certificate.p12 key.p12 certificates.pem key.pem ck.pem certificates.cer what suggest is, instead of converting .pem file .pfx on end , send .pem file server side , ask web-service developer change .pem .pfx on end.

mvvm - MapControl DataTemplate Binding with an ObservableCollection in WP 8.1 WinRT App -

how bind mulitple location in maps:mapcontrol? have json data of lattitude & longitude. have put them in observablecollection in model class, made inotifychangeproperty of in mainviewmodel. cant bind collection in xaml maps:mapcontrol data template. please help. simple sample helpful.

sdk - Android - microsoft office viewer in my app -

what have / tried: i developing android application. in have add viewer microsoft office documents( doc, docx, ppt, pptx, xls, xlsx ) users. have searched in internet. got reference apachi poi , doc4j android. so tried implement inside app. got lot of issues , not getting api references that. have posted question in stackoverflow . didn't solutions that. so deciding add other third part office viewer sdks inside app view microsoft-office documents. i searched in internet , got following third party document viewers. directoffice-mobile-sdk aspose what want: other third party office document viewer sdks available android? , best 1 implement inside app? give suggestions on this? i know it's 2 years since question, people still asking if there solution. the answer might more obvious think - use microsoft graph sdk: http://dev.office.com/android there are, of course, equivalent ios sdks well: http://dev.office.com/ios although sdks aren't obvio

c++ - Native Messaging host not able to send 1 MB data -

i using native-host in c++, when send base64 native app chrome extension(native messaging) size base64 < 1m, program still running. when send base64 native app chrome extension (native messaging) size base64 >1m, program error "error when communicating native messaging host" code below int _tmain(int argc, _tchar* argv[]) { std::cout.setf( std::ios_base::unitbuf ); unsigned int c, t=0; inp=""; t=0; // sum first 4 chars stdin (the length of message passed). (int = 0; <= 3; i++) { //t += getchar(); t += std::pow(256.0f, i) * getchar(); } // loop getchar pull in message until reach total // length provided. (int i=0; < t; i++) { c = getchar(); inp += c; } unsigned int len = inp.length(); // need send 4 btyes of length information std::cout << char(((len>>0) & 0xff)) << char(((len>>8) & 0xff)) <<

ios - Remove broken HTML tags from NSString -

my webservice returning me html content, html string might contains incomplete html tags e.g: "this broken html tag <b" or similler, now converting nsattributedstring during incomplete tags causing problems, solved if remove these incomplete html tags nsstring, suggestions how it? try code - (nsstring *)removeincompletehtmltaginstring:(nsstring *)htmlstring { nsarray *substringbyopentabs = [htmlstring componentsseparatedbystring:@"<"]; nsarray *substringbyclosetabs = [htmlstring componentsseparatedbystring:@">"]; if (substringbyopentabs.count > substringbyclosetabs.count) { return [htmlstring substringtoindex:(htmlstring.length - ((nsstring *)[substringbyopentabs lastobject]).length) -1]; } else { return htmlstring; } } test: nslog(@"%@",[self removeincompletehtmltaginstring:@"this <xx> broken html tag<b"]); output is: "this <xx> broken ht

bash - Need help on Linux Shell Script to find a pattern of strings -

grep excellent utility, when comes particular task, dont find linux command comes handy. in server, lots of hacked files injected on wordpress websites. pattern typically this. $qv="stop_";$s20=strtoupper($qv[4].$qv[3].$qv[2].$qv[0].$qv[1]);if(isset(${$s20}'q5dfb07'])) { eval(${$s20}['q5dfb07']); } now, looking linux command can find following strings in single line. isset, eval, [0], [1], [2], [3], these strings can come in order. i think, using can like, grep eval $name | grep strto | grep isset you can try grep -p : grep -p '(?=.*?isset)(?=.*?eval)(?=.*?\[\d+\])' file.php or if don't have grep can use awk : awk '/isset/ && /eval/ && /\[[0-9]+\]/' file.php

iphone - amazon ads for swift not working in ios -

i trying implement amazon ads ios using swift.the code provided amazon in objective c , have tried mirroring swift failed so.the following methods " adviewdidload " , " adviewdidfailtoload " working in objective c have stopped working in swift,but function " viewcontrollerforpresentingmodalview " working across both languages.here snippet of code @iboutlet weak var amazonadview: amazonadview! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. var option1 = amazonadoptions() option1.istestrequest = false amazonadview.delegate = self self.amazonadview.loadad(option1) } func viewcontrollerforpresentingmodalview() -> uiviewcontroller { println("........here.......") return self; } func adviewdidload(view : amazonadview) { println("........here.1......") nslog("successfully loaded ad"); } // @optional func adviewdidfailtoload

javascript - how to use angular js in zend framework 2 -

i newbee zend framework 2, , try use angular js in project. actually @ present, calling function name in controller this. return new viewmodel(array( 'result' => $result , 'userdata' => $row, 'userinfo' => $userinfo, )); and in view page. looping view. <?php if( $this->result ) { ?> <?php foreach ($this->result $data) { ?> <tr> <td><?php echo $data['patient_fname']; ?></td> <td><?php echo $data['weight']; ?></td> <td><?php echo $data['height']; ?></td> <td><?php echo $data['bp_level_low']; ?>/<?php echo $data['bp_level_high']; ?></td> <!-- <td><?php echo $data['sugar_level_random']; ?></td> --> <td>

java - Why can we directly allocate bytes in ByteBuffer but not floating Point in FloatBuffer -

in java using opengl (es) can directly allocate bytebuffer bytebuffer bf ; bf.allocatedirect(); but can not in case of floatbuffer not aviliable , why ? i wondering if because of : byte accessible in hardware level (as opengl works above hardware unlike delvik ) , registers in hardware (hardware of gpu ) in bytes , floating points numbers should stored in 4 byte register may not available cannot allocate directly , rather should tell buffer allocate memory block of given size , after put data in blocks , treat again floatbuffer. opengl es written in c. in c floats, integers etc not fixed size java. float point number in java 32 bits. lets examine how java uses opengl es. when send vertices graphics pipeline using java call c functions dirty work you. called ndk , find more info here : https://developer.android.com/tools/sdk/ndk/index.html . c translated assembly code each float can have different byte size on each phone depending on cpu architecture. use nio buffe

templates - Add header to all files created by Unoconv -

i triying create pdf files different documents same header. tried using template in unoconv messes of document. i wondering if knows how this? thanks help! i solved it. you need create ott file header user , save template.ott once have done need change command creating pdfs to unoconv -t template.ott -f pdf name_of_the_file.extension but carefull, ott template works doc, docx, , odt. the presentation files ppt or pptx not work template. you need generate template presentation files. hope helps someone.....

ios - UIDeviceWhiteColor ctFontRef unrecognized selector sent to instance -

my app crashing , showing error -[uidevicewhitecolor ctfontref]: unrecognized selector sent instance 0x7fbd7d892e60 i searched lot did't find solution when set attributed text label cell.namelbl.attributedtext = [self makeattributedstring:data.usernamestr name:data.namestr]; -(nsattributedstring*)makeattributedstring : (nsstring*)usernamestr name : (nsstring *)namestr { nsstring *tempstr = [nsstring stringwithformat:@"%@ %@",[namestr capitalizedstring],[usernamestr lowercasestring]]; nsmutableattributedstring* attrstr = [[nsmutableattributedstring alloc]initwithstring:tempstr]; [attrstr addattribute: nsforegroundcolorattributename value: [uicolor colorwithred:0.200 green:0.455 blue:0.749 alpha:1.000] range:[tempstr rangeofstring:[namestr capitalizedstring]]]; [attrstr addattribute:nsforegroundcolorattributename value:[uicolor colorwithred:0.675 green:0.718 blue:0.753 alpha:1.000] range:[tempstr rangeofstring:[usernamestr lowercasestring]]]; [attrstr add

ssas - Max value from Member Property -

i need max value of member property use in mdx expression. as example adventure works i'm using following member dofp [customer].[customer].properties("date of first purchase") member maxdofp tail ( nonempty ( [date].[date].[date] ,[measures].[dofp] ) ,1 ).item(0).membervalue select [date].[calendar year].[calendar year] on 0 ,{ [customer].[customer].&[20075] ,[customer].[customer].&[15568] ,[customer].[customer].&[20285] } on 1 [adventure works] [measures].[dofp]; i'd return june 15, 2008 rows/cols date of first purchase aaron alexander (who has max dofp of customers selected) can more calcs. instead giving me 31st dec 2010 because (i assume) that's last date in [date].[date].[date]. not pretty: with set x { [customer].[customer].&[20075] ,[customer].[customer].&[15568] ,[customer].[customer].&[20285] }

python - Matplotlib scatter plot with 2 y-points per x-point -

Image
i want create scatter plot using matplotlib. i have array of ids x-axis. looks this: x = [1, 2, 3, ...] #length = 418 for y-axis, have array of tupples. looks this: y = [(1, 1), (1, 0), (0, 0), (0, 1), ...] #length = 418 i plot in scatter plot each id (on x-axis) shows red dot first value of corresponding tupple , blue dot second value of correspond tuple. i tried code: plt.plot(x, y, 'o') plt.xlim(xmin=900, xmax=1300) plt.ylim(ymin=-1, ymax=2) plt.yticks(np.arange(2), ('class 0', 'class 1')) plt.xlabel('id') plt.ylabel('class') plt.show() it shows result: how can make plot more clear? also, when zoom in, notice points offset? how can place them directly above each other? you need store data in 2 lists/tuples instead of 1 list of two-item tuples, because plt.plot needs input. best way reorganize data this, if stuck list of tuples (or need data format other reasons), can create lists on go: plt.plot(x, [i (i

utf 8 - SQL Linked Server to UTF-8 database -

Image
i trying create linked server sql server 2008 r2 sap iq database, has utf-8 charset. i unable correct characterset viewable on queries using linked server. i have tried everything, using native ole db provider of sap iq, using odbc connectivity, playing different connection strings, major concern it's impossible because sql server not support utf-8. correct characters when viewing in interactive sql: messed characters in sql management studio: any thoughts? finally solved it, after few hours of debugging. :) you have use odbc connection, charset parameter set 'windows-1252'. works perfectly.

external - rails sorcery user_mapping possible values -

i'm using sorcery gem in rails , know possible values user_info_mapping facebook. config.facebook.user_info_mapping = {} thanks! it expects hash, where keys symbols of attributes in user (or whatever) model (like :email ) values names of attributes received facebook , documented here (like "name" ). example here .

swift - unexpectedly found nil while unwrapping an Optional value, when trying to cover toInt() -

i new in swift , trying build simple program converts number of week in days, minutes , seconds, cannot convert string int . when thought done using toint() , message appeared in line: var tempoemdias:int! = timeindays.text.toint() , fatal error: unexpectedly found nil while unwrapping optional value... does can me? code below... import uikit class viewcontroller: uiviewcontroller { @iboutlet var timeindays: uitextfield! @iboutlet var numberofweeks: uilabel! @iboutlet var numberofhours: uilabel! @iboutlet var numberofminutes: uilabel! @iboutlet var numberofseconds: uilabel! @ibaction func calculatempo(sender: anyobject) { // below: fatal error: unexpectedly found nil while unwrapping optional value. var tempoemdias:int! = timeindays.text.toint() // calcula semana var numerodesemanas:int = 0 if tempoemdias! <= 7 { numerodesemanas = 1 } else { numerodesemanas = tempoemdias! / 7 } let numerodesemanascerto:int

binaryfiles - Why is the git index file binary? -

Image
most of files in git directory plain text files (except compressed loose objects , packfiles). can cat , edit files .git/head or .git/refs/heads/master , inspect repository if gets corrupted. but .git/index binary file. wouldn't plain text file more useful because can modified hand? scott chacon shows in presentation following image (slide 278): in opinion, can put plain text file. so why binary file rather plain text file? the index, presented in " what git index contain exactly? " contains metadata and, noted below jazimov , references : index entries : references entries, metadata (time, mode, size, sha1, ...) cached trees , references trees ("pre-computed hashes trees can derived index"), helps speed tree object generation index new commit. the concatenation of data makes binary file, although actual reason pure speculation. not being able modify hand one.

xml - XSLT 2.0 loop over array select elements by attribute -

i have xml file want transform saxon-ce xslt 2.0 processor: <books> <book name="book1"> <book name="book2"> <book name="book3"> </books> i want filter xml file array. array result of selected checkboxes of webpage , passed xslt setparameter: $("input:checkbox[id='books']" ).each(function() { books.push($(this).val()); }); //books: ["book1", "book2"] xslt = saxon.requestxml("xsltfile.xsl"); xml = saxon.requestxml("xmlfile.xml"); var xsltproc = saxon.newxslt20processor(xslt); xsltproc.setparameter(null, "books", books); now want select books name occurs in array. xslt: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:param name="books"></xsl:param> <xsl:variable name="mybooks" select="/books/book[@name=$param[

macrodef - ant nesting macro call -

i call macro inside element of macro. let's suppose have following macro: <macrodef name="jc"> <attribute name="name" /> <attribute name="destdir" /> <element name="fileset-list" optional="false" /> <sequential> <jar destfile="@{destdir}${file.separator}@{name}.jar" update="false"> <fileset-list /> <manifest> <attribute name="manifest-version" value="1.0" /> </manifest> </jar> </sequential> </macrodef> and macro <macrodef name="defaultfs" description="defines default fileset"> <attribute name="path" /> <sequential> <fileset dir="${dir.build.classes}"> <include name="@{path}/**/*.class" /> </filese