Posts

Showing posts from February, 2014

c# - NancyFx and TinyIoc -

i new dependency injection.i having problems understanding how use nancyfx bootstrapper , tinyioc. want reference dependency can not understatnd how it. can not seem find correct info anywhere or misunderstanding it.this code: public class startup1 { public void configuration(iappbuilder app) { app.usenancy(); } } my interface: public interface iperson { string getname(); } my implementation: public class person : iperson { public string name { get; set; } public string getname() { return name; } } my program static void main(string[] args) { person person = new person(); person.name = "bill"; string uri = "http://localhost:8080/"; using (webapp.start<startup1>(uri)) { console.writeline("started"); console.readkey(); console.writeline("stopping"); } } my nancy bootstrapper: p

javascript - Node + Json validate key nested array -

i have sample json. in json need check following things. valid json or not. name key required without empty(list name , item name). items array length need greater 5. i attached code , not working. feel approach not good. can please suggest me correct path. var test = '{ "lists": [ { "items": [ { "name": "curd0", "sequence": 3 }, { "name": "curd1", "sequence": 2 }, { "name": "curd2", "sequence": 1 }, { "name": "curd3", "sequence": 4 }, { "name": "curd4", "sequence": 10 }, { "name": "curd5", "sequence": 9 }, { "name": "curd6", "sequence": 8 }, { "name": "curd7", "sequence": 7 }, { "name": "curd8", "sequence": 6 }, { "name": "curd9", "sequence": 5 } ], &

.net - Team explorer - Always expand changes frames -

Image
background all changes, included , excluded respectively, start out displayed within framed window, limiting view on items (immediately) visible. out of box behaviour these framed windows seem expand , collapse dynamically based on click on. i.e., seem open , close see fit, not expect it. question is there way configure these frames remain expanded? i mean frames themselves, not panels in, these should collapse/expand normal: so, if open the excluded changes (78) panel, want able see changes @ once (i'd have scroll, ofcourse). there no such settings auto expand files directly in team explorer. however, there 2 kind of views show files in team explorer. default tree view , list view . can change list view see changes @ once. click view options , choose switch list view moreover can set filters wish view changes select show filter .

asp.net - Change culture of site that is based on link -

i have asp.net 5 website culture defined in link. example: http://localhost:8080/nl/customers http://localhost:8080/fr/customers http://localhost:8080/en/customers i need implement button change language. there way without having parse url , adding language prefix myself? you can create helper method public static class urlhelperextensions { public static string routetocurrent(this urlhelper urlhelper, routedata routedata, object routevalues) { // create idictionary<string, object> var requestroutedata = new routevaluedictionary(routedata.values); var replacevalues = new routevaluedictionary(routevalues); foreach (var value in replacevalues) { if (requestroutedata.containskey(value.key)) { requestroutedata[value.key] = value.value; } else { requestroutedata.add(value.key, value.value);

java - Maven: Downloading a parent pom from the repository deletes repositories tag -

i have parent-pom stored on remote artifactory repository. parent-pom defines <repositories> tag snapshot repositories contain parent of parent-pom. when try build project using parent-pom, maven correctly finds parent-pom in artifactory repository , downloads it. during build process snapshot dependencies can't found however, since parent-pom ends in local repository missing <repositories> tag. it works fine if run mvn clean install in directory of parent-pom install locally, downloading repository seems rid of tag. this seems me bug, maybe i'm missing , intended behaviour? if so, why? there workaround can use make possible define repositories in parent-pom? parent-pom stored on artifactory server: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/p

forms - Input field with validation crashes when typing fast in Angular 2 -

Image
i have form in angular 2 simple validation using validators. the html template <form role="form" #myform="ngform" (ngsubmit)="submit()" novalidate [ngformmodel]="form"> <div class="form-group list-element"> <label for="name">name*</label> <input type="text" name="name" class="form-control" ngcontrol="name" #name="ngform" placeholder="enter name" [(ngmodel)]=user.name > </div> </form> the controlgroup validation ngoninit() { this.form = new controlgroup({ name: new control('', validators.compose([ validators.required, validators.pattern("(([a-za-z ]|[0-9])+)*"), validators.minlength(5), validators.maxlength(80) ])) }); } when type fast (random) characters in input field (e.g #1kzbzkbjkndedjk@@@kjbzdz

Multi column query on Hbase -

i have customer table customer id rowkey. have requirement query customer fist name , last name. how can scan table both columns in clause using hbase shell. know how single column. there filters can used during hbase scan ( value filter ) see more scan htable rows specific column value using hbase shell

Performance bottleneck when migrating large (millions) number of records in orientdb -

i getting serious performance issues when migrating large number of nodes along edges database (cassandra in case) orientdb. till 80 mn of nodes , 100 mn of edges, speed quite @ 1million per hour has reduced drastically 1 million in 16 hour. can issue? i using standalone instance of orientdb tomcat in embedded mode , doing document level api inserts using omassiveinsert intent.

Instagram lookup user -

i tried following endpoint: get https://api.instagram.com/v1/users/search?access_token=<token>&q=emilia_clarke but got : {"meta": {"code": 200}, "data": []} the token has public scope. did miss? thanks if on sandbox mode, can search on sandbox users. search among users, should go live. edit clients , invite few users sandbox. , give try. sandbox mode first status of instagram apps. until go live, encounter limitations. more information sandbox https://www.instagram.com/developer/sandbox/

regex - Perl Grepping from an Array -

i need grep value array. example have values @a=('branches/soft/a.txt', 'branches/soft/h.cpp', branches/main/utils.pl'); @array = ('branches/soft/a.txt', 'branches/soft/h.cpp', branches/main/utils.pl','branches/soft/b2/c.tct', 'branches/docs/a1/b.txt'); now, need loop @a , find each value matches @array. example it works me grep . you'd exact same way in more::listutils example below, except having grep instead of any . can shorten $got_it = grep { /$str/ } @paths; @matches = grep { /$str/ } @paths; this default tests /m against $_ , each element of list in turn. $str , @paths same below. you can use module more::listutils well. function any returns true/false depending on whether condition in block satisfied any element in list, ie. whether there match in case. use warnings; use strict; use most::listutils; $str = 'branches/soft/a.txt'; @paths = ('branches/soft/a.t

ios - Using pre compiled dylib in iOS8+ or building dynamic framework out of dylibs? -

i'm trying use fat dylib i've made contains latest version of tbb code architectures may targetting (armv7, arm64, i386 , x86_x64) since ios8 using dylib(s) meant possible, in fact 1 of error messages found googling following one: ld: embedded dylibs/frameworks supported on ios 8.0 , later which seems suggest embedding dylibs possible , aren't restricted new called dynamic frameworks, yet, when try run project following: dyld: library not loaded: @rpath/libtbb.dylib referenced from: /users/user/library/developer/coresimulator/devices/b4dcff3e-10b2-4c01-953f-bd26d14300e7/data/containers/bundle/application/8c84a844-97fc-4993-a37e-a456c4e2240f/testtbb.app/testtbb reason: image not found i thought due dylib not being automagically copied app being built added "copy bundle resources" section in projects "build phases" , i've since made sure libtbb.dylib in fact being copied app , yet keep getting message saying can't loaded. i'

html5 - how to set input status checked on hover only via Css? -

how can set input status checked on hover via css? setting on click need on hover, how can that? here example well not possible...with css can't create environment in radio input checked on hover because in css can style elements cannot fire event. you have use little js achieve it. here code $('input').on('hover', function(){ $(this).trigger('click'); }); above code trigger click on hover of same element.

Anything which has internal linkage can be put in header file in C++ . Why? -

eg:- below examples. explanation in every case advantage. 1. static variable/object. 2. static const variable/object. 3. const variables. 4. inline functions . static @ namespace scope means "local translation unit", you'll new copy of object in every unit includes header. same thing. these have internal linkage default. these don't, language has rule says can duplicate these in program long each "copy" looks exactly same. that's because, historically, compilers inlining on functions visible in same translation unit. nowadays, link-time optimisation exists.

.net - How to convert string date (25.04.2016) to date format (mm/dd/yyyy)? -

i have string date (25.05.2016) ,i want convert (mm/dd/yyyy) format in vb.net. please suggest solution. use parseexact format need string date variable, .tostring convert format: dim datestring string = "25.05.2016" dim dateformat string = "dd.mm.yyyy" dim datevalue = datetime.parseexact(datestring, dateformat, cultureinfo.invariantculture) debug.writeline(datevalue.tostring("mm/dd/yyyy")) the list of custom datetime formats can found here

java - sending https post request with post data using spring web -

i'm trying understand how send https post request post data using spring web or , other spring tools. so far i've been using httpclient i'm trying convert spring :) the https post request should ignore self signed certificate. please provide example on how can done. thank you i use spring integration send http post , http://static.springsource.org/spring-integration/reference/html/http.html request-factory bean need configured allow self-signed certificates. use following wiring declare apachehttpsrequestfactory used http spring integration endpoints. the httpclient bean can injected other spring beans , used send http requests: @autowired private httpclient httpclient; here fragment of spring-intefration-context.xml: <!-- https connection trust self signed certificates --> <bean id="sslsocketfactory" class="org.apache.http.conn.ssl.sslsocketfactory"> <constructor-arg name="truststrategy">

ruby on rails - An unhandled lowlevel error occurred. The application logs may have details -

i'm tyring deploy rails app digital ocean droplet , seems configured ok error: an unhandled lowlevel error occurred. application logs may have details. i'm not sure logs empty. here's nginx config: upstream puma { server unix:///home/yourcv.rocks/shared/tmp/sockets/yourcv.rocks-puma.sock; } server { listen 80 default_server deferred; server_name 127.0.0.1; root /home/yourcv.rocks/current/public; access_log /home/yourcv.rocks/current/log/nginx.access.log; error_log /home/yourcv.rocks/current/log/nginx.error.log info; location ^~ /assets/ { gzip_static on; expires max; add_header cache-control public; } try_files $uri/index.html $uri @puma; location @puma { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_redirect off; proxy_pass http://puma; } error_page 500 502 503 504 /500.html; client_max_body_size 10m; keepalive_timeout 10; } thank you! :)

android - BluetoothChat like app not communicating -

have problem while developing app based in bluetoothchat example, divided in 2 activities. the main bluetooth actions ()btactivity the chat (btcommunication) i have bluetoothchatservice divided in following files, aren't activities: transmission: handler actions connectthread connectedthread accpetthread the app finds de device, starts connecting , crashes. i'm trying find out i'm doing wrong comparing bluetoothchat app, don't find problem. 07-23 10:58:43.076: d/abslistview(17279): unregisterirlistener() called 07-23 10:58:43.076: d/abslistview(17279): unregisterirlistener() called 07-23 10:58:43.086: d/bluetoothutils(17279): issocketallowedbysecuritypolicy start : device null 07-23 10:58:43.086: w/bluetoothadapter(17279): getbluetoothservice() called no bluetoothmanagercallback 07-23 10:58:43.106: e/spannablestringbuilder(17279): span_exclusive_exclusive spans cannot have 0 length 07-23 10:58:43.106: e/spannablestringbuilder(17279): span_exclusi

R programming language - Loops -

i have final coming soon, here examples teacher has posted can't understand it. 1. for , next for(i in 1:3) { print("a") next print("b") } prints [1] "a" [1] "a" [1] "a" 2.nested for how next statement work here ? continues loop if condition set know, example (if i==3) {next} ignore proceeds i=3 how work when not under condition ? searched web couldn't find answer for(i in 1:3){ for(j in 1:3) for(k in j:i) print("*") } the code above produces 17 stars. how ? 3.another mystery my.vector <- c(1,5,9,13) my.data <- c() for(i in my.vector){ if(i <= 5){ my.data <- c(my.data, "small") }else{ my.data <- c(my.data, "huge") } my.data <- c(my.data, i) } the output of code above "9","huge","13" seriously how ? shouldn't "small","small","huge","huge&

c# - textbox and label won't hide during page_load -

i'm trying hide object txtdisc when lblusertype not string special_user . lbllock locked , visible when txtdisc visibility false, , vice versa. so put inside page_load method won't function @ all. protected void page_load(object sender, eventargs e) { buttonvisibility(); } private void buttonvisibility() { if (lblusertype.text == "special_user") { txtdisc.visible = true; lbllock.visible = false; } } change code : protected void page_load(object sender, eventargs e) { if (page.ispostback == false) { buttonvisibility(); } } private void buttonvisibility() { if (lblusertype.text == "special_user") { txtdisc.visible = true; lbllock.visible = false; } else { txtdisc.visible = false; lbllock.visible = true; } } by using if (page.ispostback == false) sure code inside executed @ first page load. ispostback property of asp.net page

bash - Shell option for automatically listing all files when cd to a folder in Linux -

i'm tired of typing ls . there command or option in shell shows files after cd folder without having type ls ? thank you! original: folder>cd subfolder subfolder>ls yu fi sd what i'm expecting: folder>cd subfolder yu fj sd subfolder> note know can use cd subfolder;ls not want type ls boring. basically seeking command embedded inside shell can turn on or turn off feature wish. if want ls after cd you need in .bashrc define cd function using like: cd() { builtin cd $@ ls } if want ls after each command in shell: then set in .bashrc like: prompt_func() { export ps1="$(ls)\n$ " } export prompt_command=prompt_func

clojure.java.jdbc/insert - Unable to insert a sequence of vectors dynamically for batch insert into sql -

this question has answer here: how pass list of vector clojure.jdbc/insert! in closure 2 answers i trying insert sequence of vectors rows in sql using clojure.java.jdbc/insert! function takes in input given in : http://clojure-doc.org/articles/ecosystem/java_jdbc/using_sql.html#inserting-data i unable map on sequence of vectors (["a" 1 "c"] ["b" 2 "d"] ["d" 3 "e"]....) dynamically mapping on since uses following syntax (j/insert! db-spec :fruit nil ; column names not supplied [1 "apple" "red" 59 87] [2 "banana" "yellow" 29 92.2] [3 "peach" "fuzzy" 139 90.0] [4 "orange" "juicy" 89 88.6]) i want able insert dynamically sql batch insert. how can this? tia. you can using a

arrays - PHP Foreach Loop stops several loops into the iteration -

i have function call returns following array nested objects. $customertransactionssummary = tickethut_get_red61via_customer_transactions_summary(); result: array ( [0] => viaapitransactionsummary object ( [orderid] => 4139:2841 [title] => 4139:dionvn:110514:174803835ib [date] => 2014-05-11 17:48:45 ) [1] => viaapitransactionsummary object ( [orderid] => 4139:4686 [title] => 4139:web001:310514:164913426os [date] => 2014-05-31 16:50:39 ) [2] => viaapitransactionsummary object ( [orderid] => 4139:4892 [title] => 4139:web001:020614:171508714rb [date] => 2014-06-02 17:15:08 ) [3] => viaapitransactionsummary object ( [orderid] => 4139:6445 [title] => 4139:web001:160614:155254808ma [date] => 2014-06-16 16:05:27

c# - got error when try to connect to MySQL -

i have c# webservice connect mysql database, that installed on linux server. when run webservice (in c#) that try connect database got error: connector/net no longer supports server versions prior 5.0 i searched lot on network tried sorts of things - without success what more try edit: the server , database government server , can not update it

javascript - Regex for 8 digit phone number (Singapore number length) -

i'm trying validate phone address text field. can provide me simple regex either validate numeric digits or specific 8 digit regex? much thanks! $('#phone').on('input', function() { var input = $( ); var regex = /* regex needed here */ var is_phone = regex.test(input.val()); if (is_phone){input.removeclass("invalid").addclass("valid");} else {input.removeclass("valid").addclass("invalid");} }); it allow 0-9 numbers , 8 digits. try this: var regex = '/^[0-9]{1,8}$/'; // if want min 1 , max 8 numbers var regex = '/^[0-9]{8}$/'; // if want exact 8 numbers

c# - I can only add a record to my database for one time why? -

i'm trying add record database c# project. i can add record 1 time. next time i'm trying add new record got exception. why happen? didn't change code. here code: try { connect.open(); cmd.connection = connect; using (cmd = connect.createcommand()) { cmd.commandtext = @"insert [kalorivediyet].[dbo].[uyeler](kullaniciadi,sifre,mailadresi,cinsiyet,boy,kilo,yaş,kalori) values('" + txtkullanıcıadı.text.trim() + "','" + txtsifre.text.trim() + "','" + txtmail.text.trim() + "','" + selectedcmbox.tostring() + "'," + int.parse(txtboy.text) + "," + float.parse(txtkilo.text) + "," + int.parse(txtyas.text) + "," + kalorii + ")"; cmd.executenonquery(); } } catch(exception) { messagebox.show("baglanti kurulamadı lütfen tekrar deneyin"); connect.close(); } { connect.close(); } have check if vi

jquery - javascript if condition not working? -

i sitting hours in front of following code snippet , can not running want. basically code creates navigation menu on right click, click on switcher should turn off function , on next click gets turned on again. everything works fine (like expected), little if statement on line 12 ( if ( switcher % 2 == 0 ) ) not work expected, meaning code within gets executed whether var switcher or not even. tried other conditions "> 0" , on code within gets executed. $(document).ready(function () { /* set switcher 0 */ switcher = 0; /* if switch gets clicked increment var switcher*/ $('#guidenavschalter').click(function () { switcher++; return false; }); /* if var switcher execute following code, if not nothing of this*/ if (switcher % 2 == 0) { /* not display right click browser menu */ document.oncontextmenu = function () { return false; }; /* if click within #page excluding are

asp.net - javascript skips steps and executes last command only -

can please me on js scraper coding tried create website uses asp-like coding... we use website download our latest software training manuals, , there more 50 manuals have download clicking on each item every time. download managers won't work, these pdfs linked __dopostback() nodes. if use coding 1 entry only, works perfectly, moment start batching command, skips __dopostback until last entry has been reached, , executes 1 only. i've tried adding sleep command slow down process if issue, did, sleep script x -ms , skip task of saving file loop again. note: i'm not experienced javascript, there may few issues coding below, , appreciated educating myself! i'm using google chrome , javascript console run below script: //sleep function found on stackoverflow slow down script cmdlet function sleep(milliseconds) { var start = new date().gettime(); (var = 0; < 1e7; i++) { if ((new date().gettime() - start) > milliseconds){ break;

Reading error in cassandra -

i'm having weir error trying read data cassandra table. have single-node installation, default setup. query i'm making: select component_id, reading_1, reading_2, reading_3, date component_readings park_id=2 , component_id in (479) , date >= '2016-04-09+0000' , date <= '2016-05-08+0000'; component_readings simple table, no clustering conditions: create table component_readings ( park_id int, component_id int, date timestamp, reading_1 decimal, reading_2 decimal, ... primary key ((park_id), component_id, date) ); with component_id values, works, , values, fails. error i'm getting: cassandra.readfailure: code=1300 [replica(s) failed execute read] message="operation failed - received 0 responses , 1 failures" info={'required_responses': 1, 'received_responses': 0, 'failures': 1, 'consistency': 'local_

php - Google Analytics API: Finding user age bracket and gender information -

i'm trying find age bracket , gender information of users using google analytics api using php. query tried running: function user_gender(&$analytics, $profileid) { $optparams = array( 'dimensions' => 'ga:usergender', ); return $analytics->data_ga->get( 'ga:' . $profileid, '30daysago', 'today', 'ga:users', $optparams ); } however, above query doesn't return anything. have used users metric along usergender dimension. seems wrong query?

poedit - Django .po translation -

Image
i have used following .po file in poedit use in django app (locale\el\lc_messages\django.po) greek characters in templates. some descriptive title. copyright (c) year package's copyright holder this file distributed under same license package package. first author , year. msgid "" msgstr "" "project-id-version: apografi\n" "report-msgid-bugs-to: \n" "pot-creation-date: 2016-05-04 11:27+0300\n" "po-revision-date: 2016-05-09 09:51+0200\n" "last-translator: kostas \n" "language-team: language \n" "mime-version: 1.0\n" "content-type: text/plain; charset=utf-8\n" "content-transfer-encoding: 8bit\n" "plural-forms: nplurals=2; plural=(n != 1);\n" "x-generator: poedit 1.6.4\n" "x-poedit-sourcecharset: utf-8\n" "language: el_gr\n" : .\templates\widgets\tables\tables.html:69 msgid "%(c

php - jquery using .submit() form not submitting -

i submitting form using jquery when use javascript submitted through jquery not submitting. here form code: <form method="post" id="uploadfrm" action="<?php echo site_url('filemanager/upload'); ?>" enctype="multipart/form-data" > <div class="up_wraper">click here select file </div> <input type="file" name="upload[]" id="upload" multiple="multiple" /> </form> jquery code: <script type="text/javascript"> $(document).ready( function() { $("#upload").change( function() { var value=$("#foo").val(); var file=$("#upload").val(); var arr = value.split("_"); var id = arr[1]; var type = arr[0]; if(type!='folder'){ alert('select folder upload files..!'); } else{ $("

SQL select single distinct values from multiple columns (not combined values) -

for example, have following table: userid department1 department2 ------------------------------ 1 sales marketing 2 research 3 sales and want following results distinctdepartments ------------------- sales marketing research i found lots of solutions show me distinct combined values of multiple columns, need overall distinct values, if values in same column. thankyou chris try use union both columns select department1 tab union select department2 tab note: union command eliminates duplicates

html - JavaScript get href onclick -

i trying return href attribute of link using javascript when user clicks on it. want url link linking displayed in alert instead of loading page. i have following code far: function doalert(){ alert(document.getelementbyid("link").getattribute("href")); return false; } with following markup: <a href="http://www.example.com/" id="link" onclick="return doalert()">link</a> for reason, no alert ever displayed , page loads instead. know why is? using jquery not option in case. seems order of code, try this <script> function doalert(obj) { alert(obj.getattribute("href")); return false; } </script> <a href="http://www.example.com/" id="link" onclick="doalert(this); return false;">link</a> http://jsfiddle.net/yz8yv/ http://jsfiddle.net/yz8yv/2/

Regex start matching from last occurence -

i have html code: <a href="localhost/1153,test"> <img src="test.jpg"> (...) <a href="localhost/1191,test8"> <img src="test2.jpg"> (...) <a href="localhost/9838,test"> <img src="13.gif"> (...) want match value before gif, in example 9838. no matter how try, end first match (1153). how match "backwards" known pattern? \d*(?=,.*\.gif) this matches first occurence of digits before [comma][other text][.gif] you can test here .

How do I sum variable parts of a row in Excel? -

i'm looking way sum 4 best scores out of these 6 tournaments played these 2 players. there code place in j2/j3 automatically pick best 4 scores , sum them, ignoring 2 worst scores? in advance! see picture reference still getting error you can array formula. =sum(large(d2:i2, row($1:$4))) , entered ctrl-shift-enter explanation: row($1:$4) expands array {1;2;3;4} , used large function take first, second, third , fourth highest values in given range. alternatively, can specify using array literal remove need ctrl-shift-enter: =sum(large(d2:i2, {1;2;3;4}))

Print wrong value of unsigned int variable in C -

i have written small program using c: #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { unsigned int un_i = 1112; printf ("%d , %d", (1 - un_i), (1 - un_i)/10); return 0; } my expectation is: "-1111 , -111" but result is: "-1111 , 429496618" i don't know why prints out 429496618 instead of -111. please explain me i use gcc ver 4.4.7 , os centos kernel 2.6.32 thank much! that because un_i of type unsigned int , not represent negative values. if expect result negative, need signed type, int , try this: unsigned int un_i = 1112; printf ("printf: un_i[%d] , u_i/10[%d]\n", (1 - un_i), (1 - (int)un_i)/10);

javascript - Password validation script. Add symbols -

i trying simple password strength checker. im new , couldnt find how include symbols in code.whats command add symbols? $(document).ready(function() { $('input[type=password]').keyup(function() { var pswd = $(this).val(); if ( pswd.length < 8 ) { $('#length').removeclass('valid').addclass('invalid'); } else { $('#length').removeclass('invalid').addclass('valid'); } //validate letter if ( pswd.match(/[a-z]/) ) { $('#letter').removeclass('invalid').addclass('valid'); } else { $('#letter').removeclass('valid').addclass('invalid'); } //validate capital letter if ( pswd.match(/[a-z]/) ) { $('#capital').removeclass('invalid').addclass('valid'); } else { $('#capital').removeclass('valid').addclass('invalid'); } //validate number if ( pswd.match(/\d/) ) { $('#number').removeclass('inva

php - Unable to import xlsx file in Codeigniter -

after configuration if trying import csv or xls file being able but, moment trying import xlsx file gettig error 'the filetype attempting upload not allowed'. in file mimes.php 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'), getting error ' the filetype attempting upload not allowed '. suggestion appreciated thnx. please try following on upload function use $config['allowed_types'] = '*'; //all files if working please check $_files mime type browser read .xlsx file your can check excel import (if above solution not working) http://phpexcel.codeplex.com/

android - Capture with camera and Crop the Image Capture -

i learning cropping image. follow tutorial . i follow tutorial throughly, , run code in android studio, when click button, force closed. please me, here code follow website. import android.content.activitynotfoundexception; import android.content.intent; import android.graphics.bitmap; import android.net.uri; import android.os.bundle; import android.provider.mediastore; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.imageview; import android.widget.toast; public class mainactivity extends appcompatactivity implements view.onclicklistener { final int pic_crop = 2; final int camera_capture = 1; private uri picuri; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //retrieve reference ui button button capturebtn = (button) findviewbyid(r.id.capture_btn);

android - Viewpager inside a fragment is blank when a listiview item in it is clicked and redirected to another fragment -

i using viewpager inside fragment , viewpager having listview within fragment.so when list item clicked redirected fragment in same activity. when come previous fragment(viewpager) viewpager blank! why desperate solution. suggestion appreciated. //tabs inside fragment public class tabspageradapter extends fragmentstatepageradapter { public tabspageradapter(fragmentmanager fm) { super(fm); } /* @override public fragment getitem(int position) { // getitem called instantiate fragment given page. return pagefragment.newinstance(position + 1); } @override public int getcount() { return 3; } @override public charsequence getpagetitle(int position) { return "tab " + (position + 1); }*/ @override public fragment getitem(int position) { fragment frag = null; switch (position) { case 0: frag = new full_roaster_fragment(); break; case 1: frag = new by_sport_fragment(); break; case 2: frag = new by_team_fragment(); break; case 3: frag = new video_critique_fragment(); break; } r

node.js - Cucumber.js execute same scenario multiple times -

i have created following feature: feature: performing test scenario: test given situation x when y occures z should checked it stored single test in feature file. now want able execute scenario multiple times based on parameter indicating how many times scenario needs executed. based on timing, how long scenario should repeating itself.

swift - Call iOS webview HTTPS (self-signed certificate) -

i want call https url (self-signed certificate) in ios app. works on mobile browser not in app webview. is there solution xcode 7 , swift 2.2? override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let url = nsurl(string: "https://xxx.xxx.x.xxx:xxxx") let request = nsurlrequest(url: url!) webview.loadrequest(request) } you have install self signed certificate or ca on device in order device trust device trusts ssl connection. in case of installing self signed certificate make sure domain name of url same common name of certificate. if there no domain name ip address fine. certificate installation: you can host on web server , try access safari ios prompt certificate installation in ios device certificate creation: here way create self signed certificate can fill details , host in web server. openssl req -x509 -newkey rsa:2048 -keyout key.pem

mysql - SELECT with temporary column with value based on other column -

i have mysql table schema resembles json array below. [ { "id": 1, "firstname": "charles montgomery", "lastname": "burns", "managerid": 12}, { "id": 2, "firstname": "bart", "lastname": "simpson", "managerid": 1}, { "id": 3, "firstname": "marge", "lastname": "simpson", "managerid": 1}, { "id": 4, "firstname": "lisa", "lastname": "simpson", "managerid": 1}, { "id": 5, "firstname": "maggie", "lastname": "simpson", "managerid": 1}, { "id": 6, "firstname": "homer", "lastname": "simpson", "managerid": 4}, { "id": 7, "firstname": "ned", "lastname": "flanders&quo

Http Statuscode when waiting for lock-release takes to long? -

i using lock mechanism make sure 2 parallel calls not update same row causing unexpected behavior. code this: (no real world example) public class usercontroller { public actionresult addreputation(int id, int repamount) { int lockwait=0; bool alreadylocked=true; while (alreadylocked) { alreadylocked=getlockforuser(id); thread.wait(1000); lockwait++; if (lockwait>10) { return new httpstatus(xxx); } } setlockforuser(id); adduserrep(id,repamount); return new content("well done"); } } so. if after 10 seconds lock still exists, want tell caller "please try again later, else saving data user". what best http-code in rest-api that? 409 conflict ? or 423 locked ? note: no sql-db. got no real transaction-mechanisms can use. have implement own locking mechanism. you should ask yourself: client want in situation? from description, sounds client’s choice wait , try again lat