Posts

Showing posts from April, 2015

java - Is there a way to compare lambdas? -

say have list of object defined using lambda expressions (closures). there way inspect them can compared? the code interested in is list<strategy> strategies = getstrategies(); strategy = (strategy) this::a; if (strategies.contains(a)) { // ... the full code is import java.util.arrays; import java.util.list; public class closureequalsmain { interface strategy { void invoke(/*args*/); default boolean equals(object o) { // doesn't compile return closures.equals(this, o); } } public void a() { } public void b() { } public void c() { } public list<strategy> getstrategies() { return arrays.aslist(this::a, this::b, this::c); } private void teststrategies() { list<strategy> strategies = getstrategies(); system.out.println(strategies); strategy = (strategy) this::a; // prints false system.out.println("strategies.contains(thi

Java BigInteger variable -

in code have check if string valid number following try{ new bigintger(numericstring); }catch(numberformatexception e) { throw numberformatexception; } i know sort of hack/workaround whatever it, wanted know new bigintger(numericstring) must creating object in heap if assign value variable biginteger val = new bigintger(numericstring) variable val stored ? it sounds basic not able imagine difference between two. val reference object itself, object stored in heap , pointer stored in stack. the actual value of val in stack address of object in hep. the new reserved word in java, says reference returned, in first case dont save object usual created in stack collected in short while. in second case, while val still in stack , pointing object, stay in heap

html - how to play youtube video at last when all element is load -

i load youtube video in page , buy play before other element load. page loading speed make slow... <div class="wel_come_msg"> <div class="video_box"> <iframe width="100%" height="315" src="//www.youtube.com/embed/rdm7wstkg8s?autoplay=1" frameborder="0" allowfullscreen></iframe> </div> </div> change iframe to <iframe id="video" width="100%" height="315" frameborder="0" allowfullscreen></iframe> jquery $(document).load(function(){ $("#video").attr("src","http://www.youtube.com/embed/rdm7wstkg8s?autoplay=1") });

javafx - Netbeans giving me the runs -

Image
netbeans javafx not deleting run files after exiting, example: these files created in dist folder when run or debug application within netbeans, , should deleted when quit them, not. does know of solution enable automatic deletion of these folders?

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

so i'm trying install zoneminder , have run under nginx, has few compiled files need run using fast-cgi. these files lack extension. if file has extension, there no issue , nginx interprets file , return 404 if can't find it. if has no extension, assume it's directory , return 404 when can't find sort of index page. here have now: # security camera domain. server { listen 888; server_name mydomain.com; root /srv/http/zm; # enable php support. include php.conf; location / { index index.html index.htm index.php; } # enable cgi support. location ~ ^/cgi-bin/(.+)$ { alias /srv/cgi-bin/zm/; fastcgi_pass unix:/run/fcgiwrap.sock; fastcgi_param script_filename $document_root/$1; include fastcgi.conf; } } the idea is, under cgi-bin directory goes through fastcgi pipe. any idea on howi can fix this? upon closer inspection, realized zoneminder has 2 cgi sc

c# - Model for confirmations in MVC app -

i have requirement has update start date of period payment. if change it, need check if there transactions outside of period. if there need popup confirmation, saying "are sure want change date 13th of july, 2014. there 18 transactions before date deleted." how handle far pattern goes? @ moment, mvc application controllers have 'get' , 'save' controller method. like, ' transaction(int accountid) ' get, , ' transactions(transactionmodel model) on save. confirmation, need controller method? what's standard doing tis sort of confirmation? adding ' confirmtransaction(transactionmodel model) ' gets called if confirmation required? additionally, i'd same view used.. using modal popup handle confirmation. you can this: when user submits form, stop post, , make ajax request action, @ date field , calculations mention, action return data display in modal. when receive ajax result, can show modal, if user clicks ok, subm

sql In clause with wildcards (DB2) -

is there anyway use wildcards in clause similar "in", this select * table columnx xxxxxxx ('%a%','%b%')? i know can do: select * table (columnx '%a%' or columnx '%b%') but i'm looking alternative make querystring shorter. btw: i'm not able register custom functions, nor temp tables, should native db2 function. i found similar answer oracle , sqlserver: is there combination of "like" , "in" in sql? there's no native regular expression support in "puresql" db2, can either create own in: http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html or use purexml in: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.xml.doc/doc/xqrfnmat.html example: where xmlcast(xmlquery('fn:matches(\$text,''^[a-za-z 0-9]*$'')') integer) = 0 yet variant may shorter: select t.* table t join ( values '%a%

Java method to return String that can be used in SQL IN statement -

i have comma separated string need convert in order use in sql in statement e.g select * table filedvalue in(conversion) below method have come far. value being passed parameter parameter gbl075,gbl008 public string paramconverter(string parameter) { string conversion=""; string newstring=""; string[] parts = parameter.split(","); for(string part : parts) { newstring = newstring.concat("'"+part+"',"); } conversion = new stringbuilder().append(newstring).tostring(); int ind = conversion.lastindexof(","); conversion = new stringbuilder(conversion).delete(ind,ind+1).tostring(); system.out.println(conversion); return conversion; } however when read console output below results variable conversion 'gbl075','gbl008' 'gbl075

Android Studio 0.6.0 Facebook SDK Import -

Image
i followed using facebook sdk in android studio , since have libs folder under 'app' folder, tried import in there selecting libs , file-->import module. this: i'm able run profilepicturesample, relies on facebook module, not app. logcat says " java.lang.noclassdeffounderror: com.facebook.android.facebook" though can verify it's there. messsage after cutting facebook module , pasting libs folder. here snippet of app-->build.gradle: dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile files('libs/parse-1.5.0/parse-1.5.0.jar') ... you don't add under libs folder, can @ same level "app". in app/build.gradle, add line: "compile project(':facebook')"

linux - What do "!" and "*" mean in the password section in /etc/shadow? -

in /etc/shadow file, looks follows. root:!:15764:0:99999:7::: daemon:*:15749:0:99999:7::: what these characters ("!" , "*") mean in password section? from manual page shadow(5) : encrypted password refer crypt(3) details on how string interpreted. if password field contains string not valid result of crypt(3), for instance ! or * , user not able use unix password log in (but user may log in system other means). this field may empty, in case no passwords required authenticate specified login name. however, applications read /etc/shadow file may decide not permit access @ if password field empty. this field may empty, in case no passwords required authenticate specified login name. however, applications read /etc/shadow file may decide not permit access @ if password field empty. also, program passwd (see passwd(1) ) can locked create these locked accounts prefixing password ! : -l, --lock lock

ASP.Net , C# Web Application, how to play video sitting on client side -

i have cloud based asp.net, c# web application. want web application invoke videos sitting on clients's private network play. the client have videos stored on file server in private network. want play video (via unc path video stored on client's private network), path (\fileserver\videos\xxxx.mp4) on page hyper when user clicks link video play in whatever compatible media player on client pc. client pc , file server on same network. cloud based application hosted on different network has no link network of client pc , file server except via web. i don't want upload videos web server , stream them easy , works because of bandwidth issues. want store location of video , invoke play via web application (url/file path can clicked on page) is there way web application access files/resources on client side in case want play videos. if there no out of box functionality there work around please help..... you can use html 5 element play videos, meant ? <vi

c# - Asp.net MVC real time application performance -

i'm trying create asp.net mvc web application ,some pages need show data in "real time" ,this data on sql server database ,the data changing created stored procedure in sql server , call procedure in controller using entity framework linq , send result browser using ajax used outputcashing minimize number of execution of stored procedure , in same controller there multiple methode use same stored procedure ,every methode execute same procedure , how emprove performance of application , there way execute stored procedure 1 time controller ?? this controller objective minimize use of database [outputcache(duration = 20, varybyparam = "*")] public class jobsetlcontroller : controller { private etl_rep_mauientities db = new etl_rep_mauientities(); public objectresult<biogetetljobs_result> etljobs; public jobsetlcontroller() { etljobs =db.biogetetljobs(); } public actionresult indexp() { var y

GitHub : Is it possible to search inside code and sort by stars -

i'm not sure if right forum question. saw quite few q&a related search on github, hence posting here. e.g. search code inside github project github advanced search allows terms stars:>100 query term restricted repository names only. possible search term inside files (code) & sort stars? aim see popular repos using particular keyword in code. useful if github's advanced search options repositories worked code also.

c# - Problems with Raycast for ARCamera in Unity3d with Vuforia SDK -

i new vuforia. the gameobject script added, 3d object made visible on user-defined triggered image. i know not new question , have gone through each of thread/post on official vuforia discussion blog matter problem still persists. , problem seems fundamental. i have following script attached gameobject : void update () { if (input.touchcount == 1) { // touches performed on screen ray ray; raycasthit hit; debug.log ("2"); if(camera.main != null) { debug.log ("3"); ray = camera.main.screenpointtoray(input.gettouch(0).position); hit = new raycasthit(); debug.log ("33"); if(physics.raycast(ray, out hit)) { debug.log ("4"); } } } } when run scene , touch on gameobject, debug console shows 2 3 33 but not 4. somehow ray doesn't hit object

javascript - Calling done on an array of http.get requests in Node.js -

i have array of urls i'm using loop call http.get requests. since async process, i'd call done after requests have returned. here current attempt: grunt.registertask('verify', function() { var done = this.async(); var promises = []; var urlprefix = 'http://example.com/'; for(var = 0; < deployablefiles.length; i++) { (function(i) { var deferred = q.defer(); promises.push(deferred); var file = deployablefiles[i]; var path = file.filetype + '/' + getversionedfilename(file.basename, file.filetype); http.get(urlprefix + path, function(res) { deferred.resolve(); if(res.statuscode === 200) { grunt.log.oklns(path + ' found on production server.'); } else { grunt.log.error('error! ' + path + ' not found on production server!'); }

java - How to use compareToIgnoreCase -

i given example on how alphabetically sort actor objects in array. public class alphasortingexchange { public static void main(string[ ] args) { string[ ] names = {"joe", "slim", "ed", "george"}; sortstringexchange (names); ( int k = 0; k < 4; k++ ) system.out.println( names [ k ] ); } public static void sortstringexchange( string x [ ] ) { int i, j; string temp; ( = 0; < x.length - 1; i++ ) { ( j = + 1; j < x.length; j++ ) { if ( x [ ].comparetoignorecase( x [ j ] ) > 0 ) { // ascending sort temp = x [ ]; x [ ] = x [ j ]; // swapping x [ j ] = temp; } } } } } i allowed follow s

objective c - How to access property in sub method after it runs? -

i'm having hard time working 1 out think should pretty simple. basically, have method talks webservice , need return data sub method, "authcode". doing wrong? how can authcode out of manager, or can create block or to ensure manager block runs first? using right words - blocks, sub methods??? please :) - (nsstring *)getauthcodeexample { __block nsstring *returnstring = @"nothing yet!"; nsurl *baseurl = [nsurl urlwithstring:baseurlstring]; nsdictionary *parametersgetauthcode = @{@"req": @"getauth"}; afhttpsessionmanager *manager = [[afhttpsessionmanager alloc] initwithbaseurl:baseurl]; manager.responseserializer = [afjsonresponseserializer serializer]; [manager post:apiscript parameters:parametersgetauthcode success:^(nsurlsessiondatatask *task, id responseobject) { if ([task.response iskindofclass:[nshttpurlresponse class]]) { nshttpurlresponse *r = (nshttpurlresponse *)task.response; if ([r statuscode] == 200) {

Is there a way to find out bitbucket team repositories names using git? -

i have bitbucket team has several repositories forgot user password login. have user password credentials team through can access , clone repo. there way find out names or link repositories in scenario? api or git command do. have searched way on bitbucket site not find information. you can test listing repostories rest browser api , entering credentials have, , testing a: https://bitbucket.org/api/1.0/user/repositories/ or, in case, selecting 2.0 api: https://bitbucket.org/api/2.0/teams/{teamname}/repositories (replace {teamname} name of team) th op anuj adds in comments : i made work asking administrator creating user me. default, bitbucket team user disabled.

cordova - Phonegap wp8.1 app pushes body out of CordovaView -

Image
i developing app using phonegap 3.x + sencha touch 2.3.1 when softkeyboard shown (tap foucus input/textarea), body moves up. when hide softkeyboard, body didn't restore normal. any of appreciated! this issue occurs if hide status bar (shell:systemtray.isvisible="false"), have workaround issue, modify file \platforms\wp8\mainpage.xaml , change : <my:cordovaview horizontalalignment="stretch" margin="0,0,0,0" x:name="cordovaview" verticalalignment="stretch" /> to: <my:cordovaview horizontalalignment="stretch" margin="1,0,0,0" x:name="cordovaview" verticalalignment="stretch" />

html - Display form in tabular form using bootstrap -

Image
i display form in tabular form this: <div class = "row"> <table class="table"> <thead> <tr> <th> selection </th> <th> ticket type </th> <th> price </th> <th> quantity <th> </tr> </thead> <tbody> <tr> <td> <input type="radio" value="selected"></td> <td> 3d </td> <td> 16000 </td> <td> 1 <td> </tr> </tbody> </table> </div> how intergrate form elements bootstrap enable me that? example of how form should in image attached take @ jsfiddle : html: <div class="container"> <div class="panel panel-default"> <div class="panel-heading"><b>ticket details</b

jsf - datatable paginator primefaces not working -

i'm trying include paginator on datatable it's not working, have table , paginator shows it's not working, int page 1 !! code : ![datatable paginator not working ][1] <h:form id="form"> <p:outputpanel id="users"> <p:datatable id="userstable" value="#{personbean.allpersons}" paginator="true" rows="4" var="person" > <p:column> <f:facet name="header"> <h:outputtext value="name" /> </f:facet> <p:commandlink action="#{personbean.editperson}"> <h:outputtext value="#{person.name}" /> <f:setpropertyactionlistener target="#{personbean.person}"

objective c - Core Data before Update callback -

i have entities have createdat , updatedat properties. trying set value of attributes automatically upon insert/update. after doing research, found out there awakefrominsert method use set value of createdat property automatically when new object created. however, not find similar updating object. should do? have update updatedat property manually every time? it depends want achieve. updating on save at: -(void)willsave; remember modifying properties @ place call willsave again. so, have update updatedat once. also, have check object wasn’t deleted - isdeleted . you may observe properties , set updatedat date when updated, not saved.

c++ - Sorting an array using a C-style comparator -

i need implement sort function called c. interface looks (and, as or else change it, can't): typedef int (*comparator )(const void*, const void*, void*); void c_sort(void* ptr, long count, long size, comparatorfunc comp, void* userdata); i can use c++ implement function, cannot change interface. can see 3 things do: write own sort function. sounds bad idea, since we're responsible maintaining it, , difficult implement implementation in either c or c++ standard library without spending 3 weeks or more on it. call qsort. problem here comparator takes void* third argument, caller wants pass in implement comparator. use std::sort , comparator wrapper around function pointer. favoritest option, because seems easier other three. in addition, whatever implementation settle on needs thread-safe, can't assign static global pointer userdata , use global pass userdata comparator. anyway, assuming number 3 go (though i'm open other options), here's question: c

ios - Undefined symbols for architecture armv7 _OBJC_CLASS_$_ALApplicationList theos -

i trying use applist rpetrich display applications' list dynamically. getting following error while compiling; undefined symbols architecture armv7: "_objc_class_$_alapplicationlist", referenced from: objc-class-ref in settings.mm.9ffba1be.o ld: symbol(s) not found architecture armv7 i think have placed required header files , library @ correct place mentioned in link i.e. header files in theos include folder , libapplist.dylib in theos' lib folder . here makefile: makefile: include theos/makefiles/common.mk bundle_name = settings settings_files = settings.mm settings_install_path = /library/preferencebundles settings_frameworks = uikit settings_private_frameworks = preferences settings_libraries = applist settings_ldflags = -lapplist include $(theos_make_path)/bundle.mk internal-stage:: $(echo_nothing)mkdir -p $(theos_staging_dir)/library/preferenceloader/preferences$(echo_end) $(echo_nothing)cp entry.plist $(theos_staging_dir)/lib

impresspages - InpressPages not upload images -

i trying upload image, not displayed neither in admin-panel nor on page. i see file has been uploaded /file/repository, impresspages trying /file/yyyy/mm/dd path. how fix uploading images? php version 5.3.3-7 gd version 2.0 check php memory limit setting. 100 mb of memory can handle 3mb jpg image. also try upload smaller image. 100kb or so.

informix - SQL IF/CONDITIONAL Querty -

is possible structure query display static value row based on column? eg. in informix, syscolumns type returned integer. have print out table type string rather integer. for example, when run simple query system tables select * syscolumns tabid < 100 i get colname tabid colno coltype collength ------------------------------------------------ tabname 1 1 13 128 where coltype = 13 corresponds varchar so original query give me colname coltype col1 0 col2 1 ... but want returned as colname coltype col1 char col2 smallint ... is such thing possible in single query? select column, case when coltype = 0 'char' when coltype = 1 'smallint' else cast(coltype varchar) end coltype mytable so, example, table: column | coltype -------------+-------------- col1 | 0 col2 | 1 col3 | 2 th

ios - Function Parameter Names don't behave according to documentation -

according manual: function parameter names these parameter names used within body of function itself, , cannot used when calling function. these kinds of parameter names known local parameter names, because available use within function’s body. join("hello", "world", ", ") func join(s1: string, s2: string, joiner: string) -> string { return s1 + joiner + s2 } but code doesn't compile: error: missing argument labels 's2:joiner:' in call join("hello", "world", ", ") ^ s2: joiner: only when try 1 parameter, becomes optional join("hello") func join(s1: string) -> string { return s1 } even more annoying, it's not permissible use first 1 @ all: join(s1: "hello") extraneous argument label 's1:' in call join(s1: "hello") did miss while reading documentation covering functi

python - Run-Length encoding gives the same number to all repeating values -

i building compressor short strings mixing different compression algorithms , rle 1 of , giving problem. the script have following, altough pretty incomplete @ moment: # -*- coding: utf-8 -*- import re dictionary = {'hello':'\§', 'world':'\°', 'the': '\@', 'for': '\]'} a_test_string = 'hello******** world****!' def compress(string, dictionary): pattern = re.compile( '|'.join(dictionary.keys() )) result = pattern.sub(lambda value: dictionary[value.group() ], string) ''' here should implement snippet check characters beginning "\" won't replaced , screw result. ''' character in string: occurrence = string.count(character*2) there_is_more_than_one_occurrence = occurrence > 1 if there_is_more_than_one_occurrence: second_regex_pass_for_multiple_occurrences = re.sub('\*\*\*+', '/

c++ - Can a preexisting return of a typecast NULL be safely compared to a newer nullptr? -

i required use library written before c++11, , 1 of functions can return typecast null. i'm trying write program following c++11 standards, when protecting against null reference, use like: if(retptr==nullptr){...} is safe comparison? arguments sake between (int*)null , (int*)nullptr? or should use an: if(retptr){...}? can preexisting return of typecast null safely compared newer nullptr ? yes. cppreference.com : there exist implicit conversions nullptr null pointer value of pointer type , pointer member type. similar conversions exist value of type std::nullptr_t macro null , null pointer constant. as praetorian kindly pointed out , corresponding section of standard 4.10 [conv.ptr] . see what nullptr?

Debugging PowerShell -

i'm not wrong scriptlet. i'm trying break out functionality several other functions (i have programming background not scripting 1 per se) , me logically following should execute starting @ "main" function test-sgnedmpspackage, accepting various optional parameters (the script not yet complete) when function check-path called, run, work resume in original calling function. am missing here? on side note, how 1 return value calling function? simple return? function checkpath($path) { if ( test-path -path $path ) { write-host "{0} confirmed exist." -f $path } else { write-host "{0} not exis.\nplease check , run script again" -f $path } exit { exit } } function test-signedmpspackage { param( [string] $pkgsource, [string] $sigsource, [string] $destination ) process { #check both files exist write-host "check file existence..." checkpa

not implemented by SQLite JDBC driver -

i have created coldfusion datasource sqlite database using sqlitejdbc-v056.jar . added query .cfm page <cfquery name="qry" datasource="spiceworks"> select id ticket_number, summary summary, status status, created_at created_at, assigned_to assigned_to tickets status = 'open' , assigned_to null order created_at desc </cfquery> when browse .cfm page in ie , firefox, error: not implemented sqlite jdbc driver the error occurred in c:/inetpub/wwwroot/intra/smarttv/unassignedtickets/tickets.cfm: line 204 202 : 203 : 204 : 205 : select 206 : id, sql select id, summary, status, created_at, assigned_to tickets status = 'open' , assigned_to null order created_at desc datasource spiceworks resources: check coldfusion documentation verify using correct syntax. search knowledge base find solution problem. stack trace at cftickets2ecfm1617356019.runpage(c:/inetpub/wwwroot/intra/smarttv

python - Starting a new event loop for chaco-traits popup window from pyside? -

i trying make numpy image slider using chaco launched pyside. ive tried using matplotlib lacked speed updating ive been trying chaco instead. script below starts initializing pyside dialog, here trying open chaco/traits window used display different views of numpy arrays using slider scroll through arrays movie. script works warning message: qcoreapplication::exec: event loop running i think need start chaco window using own thread or not sure how go it. appreciated, script below: import numpy np import sys pyside.qtcore import * pyside.qtgui import * app = qapplication(sys.argv) traits.api import * traitsui.api import * enable.api import * enable.component_editor import * chaco.api import * chaco.tools.api import * chaco import * class chacowindow(hastraits): #chaco popup window slider plot = instance(hplotcontainer) #slider max value set using frame frame = int high = 100 traits_view = view(group( item('plot',

javascript - jQuery Check user's input before form submission -

i'm trying validate user's input before submit form. although i'm successful doing when hit button, somehow couldn't make stop when press enter key: html: <form method='post' class='submit_form' action="<?php echo base_url();?>interview/reserve_temporary"> <input type="text" class="form-control email_input" id="reserve_email_2" placeholder="email"> <button type="button" id="subscribe_2" class="btn btn-default text-center foot-submit-btn subscribe_button">let me try</button> </form> js: $('.submit_form').submit(function(e) { var email = $(this).find('.email_input').val(); var id=$(this).find('.subscribe_button').attr('id').split("_").pop(); var regex_email = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".

Azure Blob Storage: Is there a timestamp for blob file? -

i need find out added blob files blob storage. there timestamp associated each blob file? if not, what's best way (for easy retrieval) add it? look @ lastmodified property of blobproperties class in icloudblob object returned getblobreferencefromserver methods of cloudblobcontainer . give timestamp looking for.

php - Search for Values in XML -

this question has answer here: php simplexml specific item based on value of field 2 answers my xml <properties> <property> <refno>001</refno> <status>active</status> <type>sp</type> <description>text text text</description> <images> <image>path_here</image> <image>path_here</image> <image>path_here</image> </images> </property> <property> <refno>002</refno> <status>active</status> <type>sp</type> <description>text text text</description> <images> <image>path_here</image> <image>path_here</image> <image>path_here</image> </images> </property> </properties>

c++ - How to load PathCchCanonicalizeEx at run-time? -

i'm trying use pathcchcanonicalizeex api make app available on os earlier windows 8. wanted load using loadlibrary can't seem figure out library comes in?

Spring Boot Testing: Cannot Autowire springSecurityFilterChain on Test Class -

i still wresting various annotations in setting test context under spring boot. i have been referring this article , refreshingly clear on how deal various contexts under spring boot . problem remaining cannot seem find annotation combination make springsecurityfilterchain visible in both main application context (driven here): @enableautoconfiguration @componentscan public class application { public static void main(string[] args) throws exception { applicationcontext ctx = springapplication.run(application.class, args); } } and test application context begun here: @runwith(springjunit4classrunner.class) @contextconfiguration(classes = {testpersistenceconfig.class,mvcconfig.class,securityconfig.class},loader=annotationconfigcontextloader.class) //@springapplicationconfiguration(classes = {testpersistenceconfig.class,mvcconfig.class,securityconfig.class}) @webappconfiguration public class applicationintegrationtest { mockmvc mockmvc; @autowired

createremotethread - Dll injection not working in suspended process -

i'm using createremotethread api inject dll process. works when process running state. if launch process in suspended state using createprocess api , try inject dll it, dll injection not working. if use createprocess without suspended flag, can able inject dll. can tell me solution of problem? i meet similar case. not know exact root cause, suggest try use queueuserapc api injection.

Android code does not insert into mysql database using PHP -

i trying insert data android code mysql database using php code not anything. register.php: <?php // array json response $response = array(); // check required fields if (isset($_post['n'])) { $name = $_post['n']; $address = $_post['add']; //$age = $_post['age']; $phone = $_post['phone']; $email = $_post['e']; $bloodgroup = $_post['bloodgroup']; // include db connect class require_once __dir__ . '/db_connect.php'; // connecting db $db = new db_connect(); // mysql inserting new row $result = mysql_query("insert bloodtb(name,address,phone,email,bloodgroup) values ('$name','$address','$phone','$email','$bloodgroup')"); // check if row inserted or not if ($result) { // inserted database $response["success"] = 1; $response["message"] = "product created."; // echoing json response echo json_encode

javascript - EaselJS: Strange behaviours when extending Container class -

Image
i'm trying extend container class strange behavior(at least strange me). i've created , item "class" in same manner it's done in createjs. i'm adding shape object when setvalue invoked. here item class: this.test = this.test||{}; (function() { "use strict"; var item = function() { this.initialize(); }; var p = item.prototype = new createjs.container(); p.initialize = function() { }; p.setvalue = function(color){ if (this.hasownproperty("bg")) this.removechild(this.bg); this.bg = new createjs.shape(); this.bg.graphics.beginfill(color).drawroundrect(-50/2,-50/2,50,50,4); this.addchildat(this.bg); }; p.getvalue = function(){ return this.value; }; test.item = item; }()); now in html perform following operations. create 2 objects , expect each of them create 1 child item of different color. result

virtual machine - How to set up 2 separate USB host controllers in VirtualBox -

i trying make application in c# use 2 kinect sensors. have red when using 2 kinect devices, have connected 2 separate usb host controllers, otherwise not work. on notebook think have 1 usb host (even though have 3 x usb 2 ports - 2 x usb, 1 x usb/esata). can not 2 kinects work. so have installed virtual box, , trying virtualize 2 separate usb hosts. way think able pass first kinect 1 virtual host , second host. possible? if so, can me , navigate me how setup 2 separate hosts in virtual box? have tried add devices in port tab in vb setting menu, not work. thank edit: first trying use 2 kinect sensors on toshiba notebook windows, use virtualbox on macbook pro 13 retina (from 2013) has 2 separate usb buses. can please me woh set up? if have experience other wirtual machine system work better, let me know. thank you.

datasource - Wildfly xa transaction warning "No security domain defined for crash recovery" -

i have wildfly server 8 , in log periodicaly 2 warnings : 2014-06-10 12:01:19,255 warn [org.jboss.jca.core.tx.jbossts.xaresourcerecoveryimpl] (periodic recovery) ij000904: no security domain defined crash recovery: java:jboss/datasources/sevicesds 2014-06-10 12:01:19,256 warn [org.jboss.jca.core.tx.jbossts.xaresourcerecoveryimpl] (periodic recovery) ij000905: subject crash recovery null: java:jboss/datasources/sevicesds my datasource config: <xa-datasource jndi-name="java:jboss/datasources/sevicesds" pool-name="sevicesds" enabled="true" use-java-context="true"> <xa-datasource-property name="url"> jdbc:mysql://my.server.local:3306/four_pm__services?useunicode=true&amp;characterencoding=utf-8 </xa-datasource-property> <driver>mysql</driver> <transaction-isolation>transaction_read_comm

javascript - Move caret to the end of a word in a tinyMCE editor -

i'm trying build function tinymce editor wraps words span tag type, far have i'm using in init_instance_callback option while initializing tinymce instance: function(ed) { ed.on('keyup', function () { var editor = tinymce.get('content'), regex = new regexp('test|abc', 'gi'), oldcontent = editor.getcontent(), newcontent = oldcontent.replace(regex, '<span style="background-color: yellow;">$&</span>'); // save cursor position var marker = editor.selection.getbookmark(2); // set new content in editor editor.setcontent(newcontent); // move cursor editor.selection.movetobookmark(marker); }); } here's fiddle working example: http://fiddle.tinymce.com/jjeaab it works fine while you're typing enter 1 of matched words (in case "test"

oracle - php compare two strings and create one based on part of the string -

i have 2 php strings comes oracle: array (size=4) 0 => string '30 jan 2014| 09:00-10:00 | workshop' (length=61) 1 => string '30 jan 2014| 10:00-11:00 | workshop' (length=61) 2 => string '06 feb 2014| 09:00-10:00 | workshop' (length=61) 3 => string '06 feb 2014| 10:00-11:00 | workshop' (length=61) ..and i'm looking way this: array (size=4) 0 => string '30 jan 2014 | 09:00-11:00 | workshop' (length=61) 1 => string '06 jan 2014 | 09:00-11:00 | workshop' (length=61) basically combine 2 same-date records 1 combined time... need while getting record in foreach($result $row){} loop.. advice appreciated. thanks basically need keep track of previous date in variable , can compare on next loop iteration. after doing comparison update contains current value. next iteration can same comparison , variable assignment. basic idea: $current_date = ''; foreach($result $row){ // date

Generate a list of the newest file in each subdirectory in windows batch -

i have need determine newest file in each subdirectory under root folder , output list text file showing both filename , creation date. example, if root directory d:\data contains total of 4 subdirectories, , 1 of 4 contain subdirectory, output file should contain list of files (not including created folders) this: d:\data\folder1\filename 02/12/14 d:\data\folder2\filename 03/02/14 d:\data\folder3\filename 03/15/14 d:\data\folder4\folder01\filename 01/22/14 i have checked other posts, none seem specifically... two options @echo off setlocal enableextensions enabledelayedexpansion set "rootfolder=c:\somewhere" :: option 1 echo -------------------------------------------------------------------------------- /d /r "%rootfolder%" %%a in (.) ( set "first=" /f "delims=" %%b in ('dir /o-d /a-d /b "%%~fa\*" 2^>nul') if not defined first ( set "first=1

jquery - From Bootstrap 2.3.2 to Bootstrap 3 how to change control group? -

i in process of upgrading latest bootstrap. use following code lot throughout forms <form class="form-horizontal"> <div class="control-group"> @html.labelfor(model => model.name, new { @class = "control-label" }) <div class="controls"> @html.editorfor(model => model.name) @html.validationmessagefor(model => model.name) </div> </div> </form> i aware controls has gone in bootstrap 3 , control-group has been replaced form-group. but once have changed once can see still not same view before. reason bootstrap 3 focusing on mobile first approach. same style need use grid view resize width of inputs. but cannot figure out how display (where display) error validation message? what best code replace these forms similar view? bootstrap 3 introduces grid form layout. need start using col- syntax indiciate how wide label , controls should be. you're g