Posts

Showing posts from May, 2015

iphone - Xcode 6 simulator has multiple iphone6 and 6+ entries -

Image
hopefully, image explains problem. why there 2 entries each 6 , 6 plus? , better yet, how can clean up? follow below steps clean : 1. tap on xcode - open developer tool - ios simulator 2. on ios simulator, tap on hardware - device - manage device here found list of devices multiple entries. select device, on right click found option delete it. can add new device here.

winforms - Creating Windows Forms labels within a tab control C# -

i'm working on project @ moment , i'm trying have every contact within arraylist has own tab page. within tab page want info displayed, i'm trying create labels have information. i'm right @ point trying @ least 1 label appear, not appear displaying @ all. code below. help? int count = 0; foreach (clscontacthandler contact in clsglobal.mcontacts) { string tabname = contact.firstname + " " + contact.lastname; font font = new font("microsoft sans serif", 16.0f, fontstyle.bold); tabpage contactpage = new tabpage(tabname); tabs.tabpages.add(tabname); label label = new label(); contactpage.controls.add(label); label.font = font; label.autosize = true; label.location = new system.drawing.point(16, 7); label.name = "label" + count; ...

android - Unable to find Picasa Web Albums Data API in developer console -

i trying enable picasa web albums data api on developer console. problem couldn't find it. when went api explorer test scope query, couldn't find api either https://developers.google.com/apis-explorer . as understand api old support developer console or apis explorer. once have client id/key can start using api documented.

django custom validation - reference submitted form value -

i trying django custom validate form field. i have written code below, cannot think of how reference submitted value of employment_record_date_display_type included in employmentrecordform. i tried employment_record_date_display_type = employmentrecordform.employment_record_date_display_type gives following error: type object 'employmentrecordform' has no attribute 'employment_record_date_display_type' here validation code in forms.py file: class employmentrecordform(forms.modelform): ............. def clean_employment_record_completion_date(self): employment_record_display_type = self.cleaned_data.get('employment_record_display_type') employment_record_date_display_type = ????????? employment_record_commencement_date = self.cleaned_data.get('employment_record_commencement_date') employment_record_completion_date = self.cleaned_data.get('employment_record_completion_date') if empl...

sql - MySQL- How to implement event scheduler everyday + start from 8am to 10 pm+ every 15 min -

i insert statistic table 1 every 15 min start 8am 10pm everyday how use mysql event scheduler it? delimiter || create event stock_updater on schedule every 15 minute begin [insert code have made] end || delimiter ; ====================================== thz @saharsh shah, solve it, here final result: create table abc (value int(10)); delimiter $$ create event abcevents on schedule every 15 second begin if (hour(sysdate()) between 14 , 15) insert abc value(123); end if; end $$ delimiter ; try this: delimiter $$ create event stock_updater on schedule every 15 minute starts '2013-11-27 12:00:00' on completion not preserve enable begin if (hour(sysdate()) between 8 , 22) begin insert abc values (123); end if; end$$ delimiter ;

C++: Check values of all object properties in a vector -

i think best explained pseudo-code: std::vector<yes> objs; //the yes class constructor: yes(x,y) //let's imagine instantiated vector 1 object somewhere appropriately void insomefunction() { for(int = 0; < 20; ++i) { int randx = rand() % mapwidth; int randy = rand() % mapheight; for(int j = 0; j < objs.size(); ++j) { if(randx > x + threshold, objects in vector && randy > y + threshold, objects in vector) { objs.push_back(yes(randx,randy)); } } } } so have window, dimensions mapwidth , mapheight , trying make 20 objects not overlap 1 in xy-plane. i want make sure randx , randy not overlapping threshold distance away other existing objects. let's threshold = 20, want make sure randx , randy not contained circle of radius 20 surrounding any/all existing object(s) in vector. example clarity: first yes object @ (x,y) = (10,20) , threshold = 20, want create second obje...

connection - Android Lollipop defaults to Mobile Data when Wi-Fi has not Internet access? -

android lollipop seems default mobile data when wi-fi connected has no internet access. know if officially documented somewhere? we have application needs connect machines via wi-fi not have internet. our customers reporting wi-fi connection not work anymore, because phone automatically switches lte . my understanding phone still keeps wi-fi connection uses lte in addition provide access internet ( lollipop-feature-spotlight-android-now-defaults-to-mobile-data-when-wi-fi-has-no-internet-access-signal-icon-adds-a-for-no-connection ). is understanding of feature wrong? , if so, there way force using wi-fi without internet? not find in particular in developer documentation. any appreciated. to extend on @ianhanniballake's answer, i've found binding network using connectivitymanager.setprocessdefaultnetwork() prevents roaming , allows full tcp access. thus, within onavailable() callback bind application process network rather opening connection particul...

PHP-Maven :: The desired archetype does not exist -

i'm trying install php-maven following instructions: http://www.php-maven.org/tags/2.0.0/php-web-5min.html and yes, did preparation instructions. i have prerequisites installed (maven 3, php > 5.2, phpdocumentor, pear in path) should changes settings.xml? copy pasted settings.xml ~/.m2 folder, no avail. while running command: mvn archetype:generate \ -darchetypegroupid=org.phpmaven \ -darchetypeartifactid=php5-web-archetype \ -darchetypeversion=2.0.0 \ -dgroupid=org.sample \ -dartifactid=my-app \ -dversion=0.0.1-snapshot i'm getting error: [info] generating project in interactive mode [warning] archetype not found in any catalog. falling back to central repository (http://repo1.maven.org/maven2). [warning] use -darchetyperepository=<your repository> if archetype's repository is elsewhere. downloading: http://repo1.maven.org/maven2/org/phpmaven/php5-zend-archetype/2.0.0/php5-zend-archetype-2.0.0.jar downloading: http://repos.php-maven.org/release...

javascript - simulate click based on CSS path from Dom element -

i working on mouse activities( mouse move, click scroll etc.) want record , playback mouse activities. have been recorded mousemove want simulate click based on css path. var csspath = function(el) { if (!(el instanceof element)) return; var path = []; while (el.nodetype === node.element_node) { var selector = el.nodename.tolowercase(); if (el.id) { selector += '#' + el.id; } else { var sib = el, nth = 1; while (sib.nodetype === node.element_node && (sib = sib.previoussibling) && nth++); selector += ":nth-child("+nth+")"; } path.unshift(selector); el = el.parentnode; } return path.join(" > "); } html > body > div#div-id > div.site:nth-child(1) > div.clearfix > ul.choices > li:nth-child(5) how can trigger click based on above css path or else based on dom. please note i, not have id or name of dom element. regards, try this: var l...

excel - How to concatenate multiple columns having n no of rows -

i'm trying concatenate 2 columns having multiple rows. formula or command steps should follow following: col1 col2 john smith denial vos i'm trying results like col1 john smith denial vos you use concatenate function. this: =concatenate(a:a," ",b:b) .

javascript - Back to last scrolled position - jquery mobile page design -

i have simple 1 page architecture. in first page loaded list items. next scrolled list , reached item 60. clicked item , took me second page. <div data-role="page" id="home"> <div data-role="header" data-position="fixed" data-tap-toggle="false"> <a href="#" class="ui-btn ui-btn-left" id="current">0</a> <h1>header</h1> <a href="#" class="ui-btn ui-btn-right" id="total">0</a> </div> <div role="main" class="ui-content"> <ul data-role="listview" id="list"></ul> </div> <div data-role="footer" data-position="fixed" data-tap-toggle="false"> <h1>footer</h1> </div> </div> <div data-role="page" id="page2"> <div data-rol...

java - My ajax call to spring rest services is pending forever -

my ajax call spring rest services pending state in chrome browser , getting "provisional headers shown not processing" in headers. once if restart tomcat server request processing successfully. the problem raising randomly... please let me know problem spring rest services side or ajax side?? appreciate help. please find screen shot chrome browser..... once request in pending state...all subsequent requests pending state... once server has been started...then requests completes successfully...please guide how solve problem??? please click below 1 see error pic.. !the request in pending state....] 1 its seems there problem services side. had issue long in application. please check below things in application check in database call...r u closing db transaction properly.? if using hibernate check session has been closed or not? check memory allocation tomcat??? check nay n/w problems security issues????? in case have not closed sessions in...

php - How to add custom field in to order grid for magento admin panel -

i have query order grid in magento admin panel. have display purchase products there qty, total weight particular order, weight unit. can 1 me how can achieve task. i tried many solution not getting it. you can use renderer add custom field code in config.xml <core_block_abstract_prepare_layout_before> <observers> <core_block_abstract_prepare_layout_before_handler> <type>model</type> <class>adminordergridcustom/observer</class> <method>adminordergridcolumn</method> <args></args> </core_block_abstract_prepare_layout_before_handler> </observers> </core_block_abstract_prepare_layout_before> your code in observer.php file public function adminordergridcolumn(varien_event_observer $observer) { $block = $observer->getevent()->getblock(); if($block instanceof mage_adminhtml_block_sales_...

java - How to create FunctionCall statement with arguments and add in function -

i need create functioncall statement utiliy.initialize("value") , add in first line of every function of js file. below code using trying create functioncall private functioncall getfunctioncall() { functioncall functioncall = new functioncall(); name name = new name(); name.setidentifier("initialize"); functioncall.settarget(name); } below code using add in every functionnode class functionvisitor implements nodevisitor { @override public boolean visit(astnode node) { if (node.getclass() == functionnode.class) { functionnode fun = (functionnode) node; fun.addchildrentofront(getfunctioncall()); } return true; } } please suggest how can create functioncall arguments , how can print created functioncall statement test. there tool available view javascript nodes java astview viewer? you have create stringliteral argu...

javascript - Multiple File Upload using array -

i have website people can upload image file. allow users upload multiple image files. find bit confusing make functions accept arrays. here have : the ui part of it: <input type="file" id="imagefile" name="imagefile[]" multiple> the handler function , used logging txt file: if(getpostputfield('imagefilename',$imagefilename)) $count=1; foreach ($_files['imagefilename']['tmp_name'] $file) { $imagefilename = urldecode($imagefilename); $uploaded = handleuploadedimagefile($kbid, $_files['imagefile'], $imagefilename); if ($uploaded) { $changesforeveryone[] .= "image file uploaded: " . $imagefilename."<br>"; $extramsg .= "<br>image file uploaded: " . $imagefilename."<br>"; } $count++; } the part file uploaded: function handleuploadedimagefile($kbid,$file,$imagefilename=null) { $result = ''; if(empty($imagefilename)) $imagefilename = $file[...

ios - Core data with Restkit -

this question has answer here: about object sequence in restkit 1 answer i want save result in same order coming server. i'm using restkit coredata. don't have added constraint it's saving in different order every time. i think may need add key createat remember can keep data in order in coredata also see question: iphone: nsset keep sort order

Create new user using Gerrit UI -

Image
i want add new user/user group using gerrit web ui, however, haven't been able sight way this. command line tedious multiple users. can tell if possible in first place? using gerrit 2.9.1 you can create new group here then, via list groups, after selecting one, can add users group here you can not create other users in web ui, new user has register himself

c# - Entity Framework Detached multiple many-to-many Entities -

usually, page have single main entity , have child entities. had solution before type of detached many-to-many e.g. db.entry(class).state = entitystate.modified; foreach(var student in class.student) { var dbstudent = db.students.find(student.studentid); dbstudent.classes.add(class); } my problem have multiple classes in view , causing "entity of same type has same primary key value" e.g. looping list of classes foreach(var class in viewmodel.classes) { db.entry(class).state = entitystate.modified; } above code throw error on reaching 2nd class if same student present in both classes. because assigning entitystate loads child entities , create 2 instances of same student. i tried manipulate creating temporary collection have single instance e.g. var students = new list<students>(); foreach(var class in viewmodel.classes) { foreach(var student in class.students) { student dbstudent = null; if(!students.any(s => s.studentid == st...

arrays - Cannot access all XML elements PERL -

i have simple perl script can parse downloaded xml file server. problem array have made seems store first set of tags. here code: sub test_button_func() { $ua->cookie_jar($cookie_jar); # make request $server_endpoint = "server_url_link"; $server_endpoint =~ s/\%id\%/$user/g; # set custom http request header fields $req = http::request->new(get => $server_endpoint); $req->header('content-type' => 'application/json'); $parser = shift; $resp = $ua->request($req); if ($resp->is_success) { # xml response received jazz api. $message = $resp->decoded_content; # parse xml downloaded here: # create object $xml = new xml::simple; # read xml file @data = $xml->xmlin($message); $arraysize = scalar (@data); # print out data need (my $num = 0; $num <= ($arraysize - 1); $num++) { print @data[0]->{'oslc_disc:entry'}[$num]{'oslc_disc:serviceprovider'}{'dc:title...

java - Caused by: android.database.sqlite.SQLiteException: near "": syntax error (code 1): , while compiling: -

11-27 03:32:04.471: e/androidruntime(23137): caused by: android.database.sqlite.sqliteexception: near "order": syntax error (code 1): , while compiling: create table order (_id integer primary key autoincrement, origin text not null, quantity integer not null); mydatabase class: public class mydatabase extends sqliteopenhelper { public static final string table_name = "order"; public static final string table_id = "_id"; public static final string table_origin = "origin"; public static final string table_quantity = "quantity"; private static final string database_name = "appple.db"; private static final int database_version = 1; private static final string database_create = "create table " + table_name + "(" + table_id + " integer primary key autoincrement, " + table_origin + " text not null, " + ta...

php - script is not working inside AJAX loaded DIV, only html is loaded? -

my javascript not working after ajax response know have use $('.ajax-link').on('click', 'a', function (e){ function when using my e.preventdefault(); not working (means whole page loading instead of ajax call) , if using $('a.ajax-link').click(function (e) { ajax working fine script of ajax response page not working after ajax response . using jquery 1.10 . below whole code : $('a.ajax-link').click(function (e) { nprogress.start(); if (msie) e.which = 1; if (e.which != 1 || !$('#is-ajax').prop('checked') || $(this).parent().hasclass('active')) return; e.preventdefault(); $('.sidebar-nav').removeclass('active'); $('.navbar-toggle').removeclass('active'); $('#loading').remove(); $('#dvloading').show(); var $clink = $(this); history.pushstate(null, null, $clink.attr('href')); ...

c++ - qt generate header file containing git hash at compile time and force rebuild using files -

i figured out how generate define macro containing git hash @ compile time: defines += git_current_sha1="\\\"$(shell git -c \""$$_pro_file_pwd_"\" describe)\\\"" the problem when git hash changed, files (mainwindow.cpp adding text dialog) using git_current_sha1 not automatically rebuilt (obviously).. i generate header file @ compile time containing git hash in const char *git_hash="git-hash-etc-etc"; and header file include in mainwindow.cpp , hope recompiled when header changes.. my question add .pro file generate such file makefile? thanks. just evidence script used git version on linux: #!/bin/bash echo "generating header git hash" $1 $2 git_header="$1/$2" if [ -z "$2" ]; git_header="$1/git_version.h" fi git_version="`git -c \"$1\" describe`" if grep --quiet $git_version $git_header; echo "no need generate new $git_header - ...

Custom Exceptions Routing to DLQ in ActiveMQ Using Spring JMS -

i using broker activemq 5.5.1 , spring jms messaging. have requirement below a) want push messages dlq when respective exception occurs. per understanding, exceptions thrown message listeners moved dlq after specified retry parameters. activemq provide facility , how ? b) have control retry mechanism based on class level meaning no-retry custom exceptions. example, if there instance of myexception class thrown, should not retry messages such should not go dlq. please advise -----edit----------- i tried restrict retry attempts when jmsredelivered true. message though exception thrown once retry not adding dlq. here test code. using activemq 5.5.1 public void onmessage(message message) { try { if (message != null) if (message instanceof textmessage) { string messagecontent = ((textmessage) message). if (message.getbooleanproperty("jmsredelivered")) { throw new customexception1(); ...

css - Flexbox does not work in Safari, striked out in Web inspector -

Image
i'm using display: flexbox div container cointaining number of squares (to make them align nicely horizontally), , works fine in chrome, not in safari 8.0, it's striked out this: #grid { overflow-x: hidden; overflow-y: scroll; position: absolute; top: 55px; left: 415px; bottom: 10px; right: 10px; display: flex; justify-content: space-between; flex-direction: row; flex-wrap: wrap; } .square { width: 166px; height: 185px; position: relative; cursor: pointer; background-size: 166px 125px !important; background-repeat: no-repeat !important; background: #fff; margin-right: 20px; float: left; } you need use prefix safari supports #grid { overflow-x: hidden; overflow-y: scroll; position: absolute; top: 55px; left: 415px; bottom: 10px; right: 10px; display: flex; justify-content: space-between; flex-direction: row; flex-wrap: wrap; displ...

R computing not so fast -

i have csv data in format price,volume price,volume 329.237000000000,0.011000000000 329.500000000000,1.989000000000 328.006000000000,0.032000000000 328.447000000000,0.010100000000 328.448000000000,0.201455000000 327.839000000000,0.011188600000 328.006000000000,0.064333000000 327.930000000000,0.020800000000 328.006000000000,0.064333000000 327.918000000000,0.011139500000 327.869000000000,0.011090600000 328.127000000000,0.033460100000 .... moreover 16m rows. what wanted group prices , amounts price based volume ohlcv ticks, 100 000 usd each tick. took 200seconds group 16000 rows it's slow... i'm using while loop have no idea how can rid of it output should this open high low close volume (usd) 1 329.237 329.500 329.237 329.500 100.00000 2 329.500 329.500 329.500 329.500 100.00000 3 329.500 329.500 329.500 329.500 100.00000 4 329.500 329.500 329.500 329.500 100.00000 5 329.500 329.500 329.500 329.500 100.00000 6 329.500 329.500 329.500 329.500 10...

mongodb - Will aggregation pipeline use index for derived field? -

in aggregation pipeline have this:- { "$project" => { account_name_i: { "$tolower" => "$account_name" }, } } { "$sort" => { account_name_i: 1 } } and have index { account_name: 1 } my question $sort use index on account_name? if no, there other way can achieve in aggregation pipeline? no. aggregation pipeline can use standard index on $match or $sort phase that's @ beginning of pipeline. rules using indexes aggregation pipelines described in detail in manual . you aim sort on lower-case version of account_name_i , function case-insensitive sort. achieve index, store lower-case-normalized version of account_name_i in each document { "account_name_i" : "truman's haberdashery", "account_name_i_lc" : "truman's haberdashery" } and index normalized field ( { "account_name_i_lc" : 1 } ).

java - What's the difference between "(ex1)|(ex2)|(ex3)" and "[(ex1)(ex2)(ex3)]" -

i'm trying create general code ease usage of regexes, , thinking how implement or function. the title pretty accurate (ex1,ex2,ex3 regular expressions). not considering grouping, what's difference between: "(ex1)|(ex2)|(ex3)" and "[(ex1)(ex2)(ex3)]" these both should or relation between named regexes, might missing something. way 1 more efficient other? (ex1)|(ex2)|(ex3) here capturing ex1 , ex2 , ex3 . here: [(ex1)(ex2)(ex3)] ( , ) quoted , treated since they're enclosed in [ , ] ( character classes ), matches ( , ) , e , x , 1 , 2 , 3 . note it's equivalent (the order not important): [ex123)(] important notes on character sets: the caret (^) , hyphen (-) can included is. if want include hyphen, should place in beginning of character class. if want match caret part of character set, should not put first character: [^]x] matches that's not ] , x []^x] matches ] , ^ or x [a-z] matches letters...

php - creating menus and forms using <a> tag instead of <form> tag? -

i'm trying learn html properly, i'm still new here. question(s): is practice create menus using <a> tags? is practice create forms using <a> tags? if yes, why bad practice creating them using <form> tags? the reason behind question did webpage using <form> both login forms , menus well. advised use <a> tags. know may work main menu, find creating functioning login forms tag simpler (since can use attributes such action, target, method , on, , can use submit input type. otherwise have write functions substitute these functionalities). i hope dont find question stupid, or worst, duplicated. thnx lot menus , forms different things. menus used navigating around website, while forms used sending data client server. generally, build menu <a> tags. technically can done using combination of <input type="button"> , javascript, instance <input type="button" onclick="windo...

asp.net mvc - Getting error The client or server is only configured for E-mail addresses with ASCII local-parts: mobilenumber‎@domainname when send email -

i using email functionality email sms of nopcommerce plugin. when send email gmail "mobilenumber‎@domainname" getting error : the client or server configured e-mail addresses ascii local-parts: mobilenumber‎@domainname and when set smtpclient.deliveryformat = smtpdeliveryformat.international; not getting error not sms in mobile. and when direct send email gmail account send email , sms successfully. please give me idea how should handle? regards, jatin gadhiya

crash - Xcode 6.1 crashes whenever I use Interface Builder -

nothing works. open interface builder on multiple different projects, cause crash. same exception. tried various solutions suggested on google & so, such clearing derived folder (i cleared whole ~/library/developer/xcode/* tree still nothing). i'm lost, , it's halting development me. i opened support ticket on developer.apple.com, haven't gotten reply yet (been 4-5 days now). process: xcode [10292] path: /applications/xcode.app/contents/macos/xcode identifier: com.apple.dt.xcode version: 6.1 (6604) build info: ideframeworks-6604000000000000~2 app item id: 497799835 app external id: 752282650 code type: x86-64 (native) parent process: ??? [1] responsible: xcode [10292] user id: 501 date/time: 2014-11-27 11:48:15.688 +0200 os version: mac os x 10.10.1 (14b25) report version: 11 anonymous uuid: f1e42fb4...

git - Does cloning a repo by a certain HASH include snapshot of included submodules? -

i need when cloning github repo submodules. using generic command : git clone --recursive ${git_source} -b master ${my_dir} and works fine. however, wondering if cloning master branch hash include submodules "snapshot" (i.e. own commits corresponding particular master commit) or updated ones if ever make 1 "on road". is possible achieve kind of result? the sha1 of submodule repo 1 recorded in gitlink entry of parent repo index . however, you can configure submodule follow branch of own remote repo , means can updated latest origin/master (if want follow master). you need add, after git clone : git submodule update --recursive --remote that update submodules content last fetched sha1 of respective remote repos. once cloned , updated, a program git-archive-all can generate tarball snapshot of repo (including submodules)

Angularjs : creating dynamic form -

i'm developing friend invitation feature website. requirements : email , has max number of invitations @ time. my idea following : at start, user sees 1 email field. when enters email adress in field, angularjs validates (email format check) , creates additional email field. now, come jquery background , think it's bad practice manipulate dom angular. how 1 angularjs ? is idea create factory "produces" (from template file) fields ? can library bootstrap ui me write simpler code form validation , error management this plunker might fulfill need @ closest: http://plnkr.co/edit/5qrxq1xgzunhyjlciyyr?p=preview the key point in technique letting user directly edit dynamic list of models. indeed in example, $scope.invites contains values. trick here referring them models: <input type="email" class="invite" name="invite{{ $index }}" ng-model="invites[$index].mail" ng-change="checkinvite($index)...

qt - Qtwebsockets Samples SSL -

i trying use qtwebsockets i've got problems ssl echoserver , client. project developed in qt 5.3.2 minigw windows 8 64 bit, can succesfully use non ssl server sample when try use ssl 1 : 1)client black 2)server prints 3 messages: qiodevice::read: device not open qiodevice::read device not open ssl echo server listening on port 1234 i think it's ssl problem not 100% sure, tried install openssl binary without success, hope can me. cheers ok problem: the error related fact sample looks certificates inside wrong directory in system , if want make running need go inside sslechoserver.cpp looking localhost.cert , localhost.key , let system point @ correct location inside sample directory.

c - Fill an array with an array? -

i'm doing electronics: i've got 12 rgb leds in circle (i call heel wheel). i'll "pulsing" each led colour in line pre-defined "levels": see below, level02 example means colour led pulsed twice every 10 cycles... code cycle through 12 leds 1 @ time. 1 cycle = 12 leds... 10 cycles = 1 colour level loop essentially want pixel[1] = colour1 , or pixel[5] = colour9 etc... pixel array heelwheel below, , colour set of constant char arrays clred , clrrg etc... ok, more detail: // color level definitions #define level00 "0000000000" #define level01 "1000000000" #define level02 "1000010000" etc... level10 char heelwheel[12][3]; //wheel pixel: led, colour (red, green, blue) // colour definitions: defining mix of colour levels 12 standard colours //(12 coincidentally == number of leds: no particular reason) const char *clred[3] = {level10, level00, level00} ; // full red const char *clrrb[3] = {level06, level00,...

javascript - How to access json data and use in if condition in following scenario? -

following ajax function code: $('#request_form').submit(function(e) { var form = $(this); var formdata = false; if (window.formdata) { formdata = new formdata(form[0]); } var formaction = form.attr('action'); $.ajax({ url : 'xyz.php', type : 'post', cache : false, data : formdata ? formdata : form.serialize(), contenttype : false, processdata : false, success: function(response) { //here i'm facing issue in checking whether $response[error_message] empty or not if (!response.error_message) alert(response.error_message); } }); e.preventdefault(); }); here in response following content coming php. content converted json format using method json_encode() { "error_message": "id can't blank<br>please select date<br>image can't bl...

html - Child ignores parent's width/height when child has margin applied to it to create spacing -

Image
i'm trying achieve attached image. it's simple concept. it's standard containing block requires children blocks positioned inside of it. that in can achieve quite easily. tricky bit i'm struggling applying spacing (margins) child elements. when apply margins children space out required overflow outside of parent container. how children maintain given dimensions (including margins) remain inside parent width? needs responsive design need percentage dimensions elements/styles. the css i've tried below. appreciated. #container { position:relative; display:inline-block; width:80%; height:20%; background:blue; box-sizing:border-box; font-size:0; } .boxes { position:relative; display:inline-block; width:25%; height:100%; box-sizing:border-box; color:#555; border:solid 1px red; text-align: center; color:#fff; margin:2%; /* <- problem occurs ============= */ }

delphi - Listbox set Item.Detail at runtime -

i new stack overflow , new delphi xe7. i stuck @ particular part of programming; have been working on multi device application , formatted listbox using livebindings designer. listbox shows first line of address (house) under item.text in livebindings , postcode property in item.detail in livebindings. therefore each entry in listbox has first line , postcode of address taken internal database. when add new address program have managed update database full address , listbox first line of address @ runtime, not know how access item.detail part @ runtime include postcode. appreciated "... how access item.detail part @ runtime" see fmx.listbox.tlistboxitem.itemdata . access in runtime via: apostcodestring := listboxitem.itemdata.detail; // when reading listboxitem.itemdata.detail := apostcodestring; // when writing when adding item listbox, take reference item @ same time: var listboxitem : tlistboxitem; ... listboxitem := listbox.items.add(som...

sql - performing calculations on a column for every 2 rows and displaying the result for the group -

i have table (current) extracted sql query. each benchmark has 2 data points. need calculate difference of 2 data points (i.e. more recent data point - less recent data point) , have result displayed alongside rows. i guess has group by, weakest area in sql , not sure how return result display alongside grouped rows. i've maanged calculate difference doing "group benchmark" , have max(value) - min(value), realised dumb have no way of knowing signage. if can so, not know how display calculated value. assitance pls? thanks. (oracle pls) current datef benchmark value 31-jul-14 a 100 31-aug-14 a 101 31-jul-14 b 101 31-aug-14 b 99 31-jul-14 c 100 31-aug-14 c 101 31-jul-14 d 100 31-aug-14 d 100 31-jul-14 e 101 31-aug-14 e 102 either this: datef benchmark value difference 31-jul-14 a 100 1 31-aug-14 a 101 1 3...

python - sqlite3.OperationalError: no such table: user -

i'm using flask server in raspberry pi archlinux arm. i have 1 script called rest.py wich contains necessary connect bdd: (...) database = 'stuff.db' (...) top.sqlite_db = sqlite3.connect(app.config['database']) (etc) if execute file.py servers runs propertly , establish connection , can rests calls perfectly, can get, post, etc. but, when execute file.py using script: #!/bin/sh sudo python file.py ..doesn't work. following error: sqlite3.operationalerror: no such table: user i've tried grant absolute permissions files (chmod 777..., know not practice don't know do... ). directory /tmp , parent directory of file.py , stuff.db full permissions. i've tried eliminate dbb , re-create it. still same. any idea guys? thank help.

PHP OOP. How to get value of constant __METHOD__ of class what create an instance of other class inside that other class? -

we have class , class b. class b have public property $class_a. few functions few functions of class b can set $this->class_a = new a(__method__); need know value of class b __method__ inside class a. i'm using inside class a: public function __construct($owner_method){ //some code.. } is possible not pass parameter during construct? is possible access such constants of "class owner" when i'm inside class ? i think need pass doing. get_parent_class exists when extending objects, not doing, passing seems not only option more proper , reusable me. in short: no, need carry on passing in, whether in constructor or individual log method.

Patch applied with system's patch but rejected by git-apply -

i'm trying understand how git apply unified diffs. i wrote following "identity" patch: --- a/js/controllers.js +++ b/js/controllers.js @@ -15,3 +15,3 @@ - '$location', - function ($scope, $routeparams, $location) { - dosomething(); + '$location', + function ($scope, $routeparams, $location) { + dosomething(); the system's patch command applies patch success while git-apply gives following output: error: patch failed: [...]js/controllers.js:15 error: [...]js/controllers.js: patch not apply i don't understand why. your patch has no context. diff have included few unmodified lines before , after changes well. git apply documentation: --unidiff-zero by default, git apply expects patch being applied unified diff @ least 1 line of context. provides safety measures, breaks down when applying diff generated --unified=0 . bypass these checks use --unidiff-zero . note, reasons stated above usage of context-...

ios - how to add four buttons in 1 row using UIAction Sheet -

Image
i new in ios. using action sheet in project.i want ask can in order add 4 buttons in uiaction sheet. here try code showing 4 buttons on 4 different rows: (ibaction)shownormalactionsheet:(id)sender { uiactionsheet *actionsheet = [[uiactionsheet alloc] initwithtitle:@""?" delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:@"delete it" otherbuttontitles:@"copy", @"move", @"duplicate", nil]; [actionsheet showinview:self.view]; } uiactionsheet has been deprecated , no longer working in ios8. uiactionsheet replaced uialertcontroller. issue might due update uialertcontroller apple documentation uialertcontroller gives full power customize alertview. if have app in app store u...

vb.net - How to copy one record set to another in VB -

i have record set, want copy data record set. dim rsattributes,loggedinuserid,rsattributes1 set rsattributes = server.createobject("adodb.recordset") set rsattributes1 = server.createobject("adodb.recordset") set rsattributes = call db data. now how can copy rsattributes value/data rsattributes1 . tried clone method, did not work.

html - css issue taking parent dimesion using % -

i had issue using height , width in % take size of parent window see below link : http://liveweave.com/gzp43q what missing , make work make canvas match width of parent width , not find how solve , think bit tricky css issue html code <script src="http://fabricjs.com/lib/fabric.js"></script> <div class="wrap"> <table align="center" width="100%" border="1"> <tr valign="top"> <td width="10%"> left </td><td width="80%"> <div id="content"> <table border="1" width="100%"> <tr><td style="border:1px solid red"> <canvas id="canvas" width="100%" height="100%"> </canvas> <div id="canvas-drop-area"></div> </td><...

symbolic math - The summation of piecewise functions in Matlab -

Image
i have piecewise function f_m(x) below, x_m , \alpha constants, m subscript. i need solve following equation involves f_m(x) , n , c constants, tau variable want solve. so resort question matlab. first write function in .m file: function y=pareto_cdf(x, xm) alpha = 2; %set alpha 2 if x < xm y = 0; else y = 1-(xm/x)^alpha; end then in .m file write: syms x; c = 1000; n = 20000; %pareto distribution cdf: f(x)=1-(xm/x)^alpha. %alpha set 2 in program alpha = 2; j=1:1:n; f=sum(pareto_cdf(x, 1/(alpha*rand()))); = f - c; tau = solve(a,'x'); however, got following error matlab when running it: conversion logical sym not possible. error in pareto_cdf (line 4) if x < xm the problem is: need declare x sym because variable in equation, since invoke pareto_cdf(x, xm) , x in function sym , matlabt not support comparison between sym , value (xm). error stems piecewise nature of function f(x) . ...

nginx - Logstash Grokked Data Does Not Reach ElasticSearch -

i have simple logstash 1.4.1 setup , data seems correct in stdout, in es/kibana "message" field not overwritten. logstash.conf input { file { path => "/var/log/nginx/access.log" type => "nginx_access" } } filter { if [type] == "nginx_access" { grok { match => [ "message", "%{nginxaccess}" ] overwrite => [ "message" ] } } } output { elasticsearch { protocol => "http" } stdout { codec => rubydebug } } nginx pattern ngusername [a-za-z\.\@\-\+_%]+ nguser %{ngusername} nginxaccess %{iporhost:clientip} %{nguser:ident} %{nguser:auth} \[%{httpdate:timestamp}\] "%{word:verb} %{uripathparam:request} http/%{number:httpversion}" %{number:response} (?:%{number:bytes}|-) (?:"(?:%{uri:referrer}|-)"|%{qs:referrer}) %{qs:agent} stdout { "message" => "127.0.0.1 - - [27/nov/2014:13:43:53 +0100] \...

App has been unlisted from Google Apps Marketplace -

i had app in marketplace around year , found unlisted. think might because 1 of instances of app using old api. fixed found no way inform google listing activated again. today, found listing has been deleted marketplace. can sharing insights on might have happened or process bring listing? or perhaps how reach out @ google resolve this? many thanks the google apps marketplace v1 (gam v1) being deprecated, during process applications not migrated new version (gam v2) unlisted. here can find information gam v2 , how publish app in new platform. https://developers.google.com/apps-marketplace/ one difference new listing version runs under chrome web store https://chrome.google.com/webstore/developer/dashboard

c# - How to refactor a bunch of methods to make them static? -

we found bunch of methods in our code made static (since functional in nature, , not alter data in class). means of course references these methods must changed also. is there refactoring command available , safely? https://www.jetbrains.com/resharper/webhelp/refactorings__make_method_static.html check #resharper think looking not sure license.

oracle - pls 00905 object is invalid -

create or replace procedure p_update_project_status(v_project_id in number(10)) declare v_bid_file_status number(2); v_bid_form_status number(2); v_supplier_status number(2); begin select status v_bid_file_status project_file type = 0 , associated_project_id = v_project_id; select status v_bid_form_status project_file type = 1 , associated_project_id = v_project_id; select status v_supplier_status supplier_info associated_project_id = v_project_id; if( (v_bid_file_status = 3) , (v_bid_form_status = 3) , (v_supplier_status = 3) ) update project_info set status = 3 id = v_project_id; else update project_info set status = 0 id = v_project_id; end if; end; i execute procedure,but it's invalid, have tried best correct it, still invalid.i don't know going wrong.please me declare keyword not necessary here. need if youre running anonymous block. remove , should compile.

java - Make a transaction inside aspect -

i have aspect method, annotated @around, there following lines: @around("@annotation(customannotation)") public void handle(proceedingjoinpoint joinpoint) { methodsignature ms = (methodsignature) joinpoint.getsignature(); customannotation m = ms.getmethod().getannotation(customannotation.class); processor processor = appcontext.getbean(m.value()); object argument = joinpoint.getargs()[0]; processor.preprocess(argument); joinpoint.proceed(); processor.postprocess(argument); } method interrupted aspect: @customannotation(value = "createprocessor") public void create(user user) { createorupdate(user); //in method user in "users" created or updated } processor.preprocess() empty. processor.postprocess(): @override public void postprocess(object obj) { //add obj "objects" table in db } all these methods (preprocess, postprocess, proceed) interact separate database tables. want make transaction th...

c# - Architecture: How to implement status which affects several UI objects? -

i can come solutions following problem find quite unsatisfying: i want several ui elements change behaviour (mostly dis/enable or change visibility) depending on status (integer between 0-8) want able modify several places in application. is there more elegant way implementing huge switch/case block in setter of status property (implementing strategy pattern doesn't seem better solution since switching 'some' flags)? maybe can magic databinding here? use dedicated flag in viewmodel ui-object-properties need change (which in turn modified in setter of status-property...) i guess sort of conditional databinding elegant thing can think of, input if there other viable ways implement this. you use converter designed convert status (int) wether or not control enabled (bool). [valueconversion(typeof(int), typeof(bool))] public class statustoenabledconverter: ivalueconverter { public object convert(object value, type targettype, object parameter, system.glo...

Create JSON format from two strings in PERL -

i've 2 string follows in perl script. $labels = "firstname|lastname|email"; $values = 'krishna|mohan|some@gmail.com'; now construct json fromat 2 srings. need split (explode) both strings base on | (pipe) symbol , construct json format follows {"firstname":"krishna","lastname":"mohan","email":"krishna@gmail.com"} how can achieve this? ideas appreciated. use split "explode" strings, build hash results. then, use json translate json: #!/usr/bin/perl use warnings; use strict; use json; $labels = 'firstname|lastname|email'; $values = 'krishna|mohan|some@gmail.com'; # doesn't work double quotes! %hash; @hash{ split /\|/, $labels } = split /\|/, $values; print to_json(\%hash);

java - Can't read Excel 2010 file with Apache POI. First Row number is -1 -

i trying testfile apache poi api (current version 3-10-final). following test code import java.io.fileinputstream; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook; public class exceltest { public static void main(string[] args) throws exception { string filename = "testfile.xlsx"; xssfworkbook wb = new xssfworkbook(new fileinputstream(filename)); xssfsheet sheet = wb.getsheetat(0); system.out.println(sheet.getfirstrownum()); } } results in first row number -1 (and existing rows come null). test file created excel 2010 (i have no control on part) , can read excel without warnings or problems. if open , save file version of excel (2013) can read expected. any hints why can't read original file or how can highly appreciated. the testfile.xlsx created "spreadsheetgear 7.1.1.120". open xlsx file software can deal zip archives , /xl/workbook.xml see that. i...