Posts

Showing posts from March, 2013

mysql - SQL RegEx Create Split: Include SET -

i'm writing regex pattern split mysql create statements column definition arrays. far, works great aside set columns. here's process: $lines = explode("\n", $create_sql); foreach ($lines $line) { $line = str_replace('not null', 'not_null', $line); $pattern = '/`(.*)`[\s]*([^\s]*)[\s]*(not_null|null)[\s]*(.*),/'; $search = preg_match($pattern, $line, $matches); if ($search !== false && count($matches) === 5) { $columns[$matches[1]] = array( 'type' => $matches[2], 'null' => $matches[3] === 'null', 'extra' => $matches[4], ); } } this process works great on column definition this: `id` int(11) not null auto_increment, ...but fails on set columns. how can best accommodate quotes , parentheses in line? `platform` set('ios', 'android') null default n

language agnostic - What is the name for reverse lens? -

lens function perform immutable record modification: copies record modifying part of content. lenses library allows combine lenses attain more complicated modifications. i'm searching correct term defines reverse abstraction. function compares 2 objects , return difference between them. such functions produce system. each modification represented simultaneously fine-grained description "field inside field b inside field c inside record" or coarse "field c inside record". can pattern match modification desired grade of accuracy. i need write code comparing records , reacting modifications inside them. avoid reinventing wheel. tried google reverse lenses drowned in non-relevant output. you can refer differential synchronisation algorithm this. algorithm based on diff , patch operations. diff part may useful you. for further reference : https://neil.fraser.name/writing/sync/

How to copy plain text value from using Javascript -

function copytext(text) { var textfield = document.createelement('textarea'); textfield.innertext = text; document.body.appendchild(textfield); textfield.select(); document.execcommand('copy'); textfield.remove(); } i found code on reddit , thought work logical create element select after execute command 'copy'. surprised didn't , not know why. no error given when running script on chrome dev console want execute , that's why don't want hear answer any api has copying. if can tell me how use api on chrome dev tools feel free let me know that. if there things left out or have questions about. the code wont work without user interaction, if try run console, not work. the way run code bind function button or that. function copytext(text) { var textfield = document.createelement('textarea'); textfield.innertext = text; document.body.appendchild(textfield); textfield.select();

java - What is the appropriate place to include Action Listner Block -

okay, have 3 classes. 1.) program driver-main class 2.)toppanel 3.) frame action listener logout button working okay kind of thought maybe there's better way separate blocks action listeners. please bear me i'm new this. best way separate action listeners block? need implement action listener on class everytime or can same thing did here here's code. toppanel class public class toppanel extends jpanel{ //declaration jbutton logoutbutton = new jbutton("logout"); toptabbedpane toptabbedpane = new toptabbedpane(); private final border mylineborder = borderfactory.createlineborder(color.black, 2); //constructor public toppanel(){ setpanelinitialproperties(); addcomponents(); } //methods private void setpanelinitialproperties(){ setlayout(new gridbaglayout()); setborder(mylineborder); //sets line border panel //setbackground(color.red); } private void addcomponents(){ gridbagconstraints toptabbedpanegbc = new gridbagconstraints

c# - WebClient() never reaching DownloadStringCompleted on WPF application -

so i'm confused, why webclient not accessing downloadstringcompleted . after reading possible problems webclient being disposed , before can finish download. or exceptions not being caught during downloaddata or uri inaccessible. i've checked against these problems, , webclient has not yet accessed downloadstringcompleted . pmid webclient class /// <summary> /// construct new curl /// </summary> /// <param name="pmid">pmid value</param> public pmidcurl(int pmid) { this.pmid = pmid; stringbuilder pmid_url_string = new stringbuilder(); pmid_url_string.append("http://www.ncbi.nlm.nih.gov/pubmed/").append(pmid.tostring()).append("?report=xml"); this.pmid_url = new uri(pmid_url_string.tostring()); } /// <summary> /// curl data pmid /// </summary> public void curlpmid() { webclient client = new webclient(); c

c# - localSettings.Containers[containername] - The given key was not present -

i looping through code looking localsettings. when container null gives error message "the given key not present in dictionary". how can check see container null doesn't crash code? if ((windows.storage.applicationdatacontainer)localsettings.containers[containername] != null) this gives same error var container = localsettings.containers[containername]; windows.storage.applicationdatacontainer settings = windows.storage.applicationdata.current.localsettings; //this checks if given container name exists or not if(settings.containers.containskey("containername")) { if(settings.containers["containername"].values.containskey("your data key")) { //do } } hope helps

swift - Warning: Attempt to Present ViewController on whose ViewController isn't in the view hierarchy (3D Touch) -

basically, trying implement home screen quick actions app. when tap on 1 of quick actions error: warning: attempt present theviewcontroller on viewcontroller view not in window hierarchy! i have looked @ other stack on flow posts had same issue, solutions didn't work me. also, in applicationdidenterbackground method added self.window?.rootviewcontroller?.dismissviewcontrolleranimated(true, completion: nil). here of relevant 3d touch methods have included in app delegate: func application(application: uiapplication, performactionforshortcutitem shortcutitem: uiapplicationshortcutitem, completionhandler: (bool) -> void) { let handledshortcutitem = self.handleshortuctitem(shortcutitem) completionhandler(handledshortcutitem) } also, have these helper methods: enum shortcutidentifier: string { case first case second init?(fulltype: string) { guard let last = fulltype.componentsseparatedbystring(".").last else { return ni

javascript - THREEjs resizing canvas with click -

i'm trying find way resize threejs/webgl canvas function function resize(){ $('#canvas').css('height', '100%'); $('#canvas').css('z-index', '1'); camera.aspect = window.innerwidth / parseint($('#canvas').css('height')); camera.updateprojectionmatrix(); renderer.setsize( window.innerwidth, parseint($('#canvas').css('height'))); } it gets job done, jumps 100% , wondering if there way smooth transition you can use css transitions if aren't strict on backward compatibility. https://developer.mozilla.org/en-us/docs/web/css/css_transitions/using_css_transitions

excel vba - With VBA how do i make the row above the "active row" in a table -

when insert row in table, inserts row above current row, fine. need able make row inserted active row. how that? structure of code is: for each row in [table] if [condition] row.insert 'this inserts row above "current" row 'here want move row inserted activesheet.cells(row.row, [table[col]].column) = 5 'arbitrary value end if next row try offset (row_no, col_no) 'to go previous row use activecell.offset(-1, 0).activate 'to got next row use activecell.offset(1, 0).activate you can try below code :) sub test() = activecell.row - 1 rows(a).activate end sub incorporated code for each row in [table] if [condition] row.insert 'this inserts row above "current" row 'here want move row inserted = activecell.row - 1 rows(a).activate end if next row

How to connect Mendix to SQL Server? -

Image
i'm learning how use mendix , i'm running problem. have database holds things such landing zones, county, , helicopter information. can't seem figure out how connect sql server database application. ideas? if want data database, have use appservices or webservices. alternatively, can connect application mssql database settings -> profile create entities in domainmodel data, , import data table using sql tool of preference ( sql express ) this work static data. if data dynamic, need webservices read more on how import or publish webservice and here on consuming one if data in mendix application, might need consume published appservice it. finally, might more feedback on mendix forum

Which one is a best file up-loader extension for Yii1.x framework? -

i using coco file up-loader extension in yii1.x framework not working properly. 1: if want delete uploaded file name status area not working. 2: not able make limit upload files if want edit file. 3: have ui issues. i using coco this. widget('ext.coco.cocowidget' ,array( 'id'=>'cocowidget1', 'oncompleted'=>'function(id,filename,jsoninfo){ }', 'oncancelled'=>'function(id,filename){ alert("cancelled"); }', 'onmessage'=>'function(m){ alert(m); }', 'allowedextensions'=>array('jpeg','jpg','gif','png'), // server-side mime-type validated 'sizelimit'=>2000000, // limit in server-side , in client-side 'uploaddir' => 'assets/', // coco @mkdir // arguments used send notification // on specific class when new

jquery - Unable to retrieve element by id from an HTML string -

i have php returns html snippet string in following format: echo '<tr><td>blah</td><td>more blah</td></tr><tr><td>blah</td><td>more blah</td></tr><tr><td>blah</td><td>more blah</td></tr><span id="morerows">1</span>'; now @ client, using jquery (2.1.4) extract text of #morerows (in example, 1) local var ifmore , remove <span> original html before further processing. following trying testing purposes: var hr = createxmlhttprequestobject(); ... var return_data = hr.responsetext; var rdashtml = $(return_data); var ifmore = $('span#morerows', rdashtml); alert(ifmore.text()); but alerts blank. http request processing fine because alert(return_data); shows value expected. extraction of <span> element somehow not working. there missing out? you have wrap code in div , because jquery parsing first tag , ignoring r

How does Python perform during a list comprehension? -

def thing(mode, data): return [ item item in data if { 'large': lambda item: item > 100, 'small': lambda item: item < 100, }[mode](item) ] this list comprehension generates dictionary of lambdas, retrieves 1 lambda via mode argument , applies list item being processed. question this: performance characteristics of this? is entire dictionary created scratch during each iteration of listcomp? or created once , used on each item? is entire dictionary created scratch during each iteration of listcomp yes. or created once , used on each item? no. fortunately, in case (and others can think of), it's easy build dict ahead of time: d = { 'large': lambda item: item > 100, 'small': lambda item: item < 100, } return [item item in data if d[mode](item)] or even, func = { 'large': lambda item: item > 100,

paypal - How do I reset a balance of a sandbox business account in the new developer UI? -

i testing mass payout functionality. use test business account hold balance, , pay out customers, verify fund has been transferred. with old ui, used able 'reset' sandbox account once in while put cash balance. with new developer ui, however, there doesn't seem way that. has able reset balance of sandbox business account? we’ll pass feedback along add functionality. in meantime, should able send payment 1 of other test accounts (we'll call account a) account that’s sending mass pay transactions (account b), giving balance. to so: log in account a> click send money > enter email address account b > enter amount want send > click continue > click send money. account b have balance , able send mass payments.

php - Try to get selected value from multiple selected value -

i have form select multiple values. showing selected value along showing error notice: undefined offset: 5 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1559 notice: undefined offset: 3 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1559 notice: undefined offset: 5 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1571 notice: undefined offset: 5 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1571 notice: undefined offset: 6 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1559 notice: undefined offset: 4 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1559 notice: undefined offset: 6 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1571 notice: undefined offset: 6 in /var/www/lo/g8_tool/g8_gusr/test.php on line 1571 for($g8_i=0;$g8_i<$g8_count;$g8_i++) { if($g8_j!=count($g8_groupy_arr)) { if($g8_groupy_arr[$g8_i] == $g8_group_y[$g8_j]) { $g8_selected = "selected"; #echo $g8_groupy_arr[$g8_i]."<br>"; $g8_j++; $g8_str.

android - I am trying to implement a View Pager with controlled swiping.But I am getting a binary inflate exception on the custom view page -

i trying disable or enable viewpager's swiping custom viewpager..but getting inflating exception on viewpager .please me. mainactivity public class mainactivity extends fragmentactivity { timer timer; int page = 0; viewpager pager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); pager = (viewpager) findviewbyid(r.id.view_pager); pager.setadapter(new mypageradapter(getsupportfragmentmanager())); pager.setenabled(false); //pageswitcher(3); } ////extending viewpager class public class hackyviewpager extends viewpager { private boolean enabled; public hackyviewpager(context context) { super(context); } public hackyviewpager(context context, attributeset attrs) { super(context, attrs); this.enabled = true; } @override public boolean ontouchevent(motionevent event) { if (this.ena

C++ converting an int to a string -

i know extremely basic i'm new c++ , can't seem find answer. i'm trying convert few integers strings. method works: int = 10; stringstream ss; ss << a; string str = ss.str(); but when need convert second , third ones this: int b = 13; stringstream ss; ss << a; string str2 = ss.str(); int c = 15; stringstream ss; ss << b; string str3 = ss.str(); i error: 'std::stringstream ss' declared here do need somehow close stringstream? i've noticed if put them far away each other in code compiler doesn't mind doesn't seem should do. have suggestions? you're trying redeclare same stringstream same name. can modify code in order work : int b = 13; stringstream ss2; ss2 << a; string str2 = ss2.str(); or if don't want redeclare : int b = 13; ss.str(""); // empty stringstream ss.clear(); ss << a; string str2 = ss.str(); you can use , quicker : int c = 42; std::string s = std::to_str

c - How do you read the arrow keys? -

extensive searching on use of raw mode termios , xterm leads numerous references "timing trick" required distinguish between escape-sequence , lone appearance of escape character. so how do it? i don't want use curses because don't want clear screen. calculator-style program, it's important retain "ticker-tape" interface. finally found nice detailed description in old usenet thread . quote relevant message in entirety. path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery from: all...@ncoast.org (brandon s. allbery kb8jrr) newsgroups: comp.unix.programmer subject: re: how read arrow keys? message-id: date: 1 jan 91 03:56:56 gmt references: reply-to: all...@ncoast.org (brandon s. allbery kb8jrr) followup-to: comp.unix.programmer organization: north coast computer resources (ncoast) lines: 68 quoted brn...@kramden.acf.nyu.edu (dan bernstein): +--------------- | it&

java - How extract files from response entity -

i have servlet gives clients many files in 1 request. put files(image,pdf,...) or other data (like json,...) byte array in response : multipartentitybuilder builder = multipartentitybuilder.create(); bytearraybody pic1 = new bytearraybody(imagebytes1, "pic1.png"); bytearraybody pic2 = new bytearraybody(imagebytes2, "pic2.png"); builder.addpart("img1", pic1); builder.addpart("img2", pic2); stringbody sb = new stringbody(responsejson.tostring(),contenttype.application_json); builder.addpart("projectsjson", sb); string boundary = "***************<<boundary>>****************"; builder.setboundary(boundary); httpentity entity = builder.build(); entity.writeto(response.getoutputstream()); i response (in client side) : string body = entityutils.tostring(response.getentity()); system.out.println("body : " + body); and body : --***************<<boundary>>****

mysql - Return number of users for each month by type -

Image
i not know how possible is: i have database in (sqlfiddle)[ http://sqlfiddle.com/#!9/d7a8f/3] , database want return following : i want return number of user created in each month based on type. there 4 role in database (administrator, no role, super user, user). just elaborate on query how want information like: e.g. january 2016, 4 , 3 ,5, 8,20. january 2015 month, 4 administrators, 3 no role, 5 super user, 8 users, , 20 overall total. user type must sorted in ascending order. i have tried following: select date_format(timestamp,' %b %y') month,usertype,count(userid) user group month,usertype you use bunch of count functions on case expressions break data respective roles: select date_format(timestamp, '%b %y') `month`, count(case usertype when 'administrator' 1 end) administrator, count(case usertype when 'no role' 1 end) norole, count(case usertype when 'super user' 1 end) superuser,

xml - How to remove `tns` prefix from elements in xsd schema inserted into wsdl? -

Image
i have wsdl xsd inserted. looks like: the question quite simple, can not find decision: how remove tns profix login , password elements? when tried remove tns appears automatically. i remove elementformdefault="qualified" <xsi:schema xmlns:xsi="http://www.w3.org/2001/xmlschema" xmlns:altova="http://www.altova.com/xml-schema-extensions" targetnamespace="http://new.webservice.namespace" elementformdefault="qualified"> in wsdl , there no tns prefix. or change "qualified" "unqualified" .

Android AnimatorSet animation + setStartDelay VS AnimatorListenener.onAnimationStart? -

i have question android animatorset object. i'm trying create textview dynamically , set it's visibility gone , make appear when animation starts after start delay. accomplish this, i've setup onanimationstart listener tell me when animation starting can set textview visible. add textview animatorset perform animations on alpha , translatey set setstartdelay value animation starts @ 2500 milliseconds. problem want textview become visible when animation starts @ 2500 milli mark, onanimationstart being called when animatorset.start() function being called, , not requested 2500 milliseconds after. resulting in textview's becoming visible before animation starts (after setstartdelay period). how overcome , textview objects go visible after setstartdelay period???? thank very much, best stackoverflow!!!! :) :) :) i have been having same issue. animating 3 valueanimators in animatorset. doing "playtogether()" in set so: set.playtogether(alpha,anim

javascript - Angularjs send empty JSON to server (ONLY in IE 9 and greater) -

i have little issue angularjs script. i'm trying post data server (php script saves values database). works correctly in chrome, mozilla, opera , each other totally not in ie. tried ie9, 10 , 11 (all without add-ons)and still can't figure out. in ie angularjs posts empty json (something {}). here's angularjs post script. $scope.submitform = function() { // posting data php file $http({ method : 'post', url : 'ajax/newinvoice.php', data : $scope.invoice, //forms user object headers : {'content-type': 'application/x-www-form-urlencoded'} }) .success(function(data) { getinvoices(); $scope.invoice = {items: [{qty: 1,description: '',cost: 0,taxperc: 21}],odberatel: '',konecny_prijemce: '',datum_objednavky: new date(),datum_vystaveni: new

Split an array of objects by property value with Javascript -

i have array objects in it. need create multiple arrays objects grouped 1 of properties value. clarify here array: var people = [ new person("scott", "guthrie", 38), new person("scott", "johns", 36), new person("scott", "hanselman", 39), new person("jesse", "liberty", 57), new person("jon", "skeet", 38) ]; i want have 1 array people first name scott, 1 first name jesse , on. suggestions helpful. to that, can loop through array entries (in any of several ways , let's use foreach here) , create object or map keyed names come across, value being arrays of entries names. here's example using object: // create object no prototype, doesn't have "tostring" // or "valueof", although unlikely names people have var namearrays = object.create(null); // loop people array people.foreach(function(person) { // name array pe

sql - While inserting multiple rows what does the statement 'select 1 from dual' do? -

while inserting multiple rows table using following style : insert ghazal_current (ghazalname,rating) values('ajab apna haal hota jo visaal-e-yaar hota',5) ghazal_current (ghazalname,rating) values('apne hothon par sajana chahta hun',4) ghazal_current (ghazalname,rating) values('shaam se aankh mein nami si hai',4) ghazal_current (ghazalname,rating) values('tumhe yaad ho ke na yaad ho',3) select 1 dual; what statement select 1 dual mean ? here ? dual built-in table, useful because guaranteed return 1 row . means dual may used pseudo-columns such user or sysdate , results of calculations , like. owner of dual sys can accessed every user. dual well-covered in documentation. find out more . in case, select 1 dual; returns 1 . need because insert syntax demands select clause not querying input values table.

numpy - Python: pivot table error -

Image
i'm trying find average hourly trips on weekends , weekdays both "annual members" , "short-term pass holder" data frame info: datetimeindex: 7795 entries, 2014-10-13 2015-10-12 data columns (total 4 columns): (hour, ) 7795 non-null int64 (trip_id, annual member) 7795 non-null float64 (trip_id, short-term pass holder) 7795 non-null float64 (weekend, ) 7795 non-null bool data frame looks in attached image i attempted below code, not working by_hour.pivot_table(index=['weekend','hour'],aggfunc ='mean',columns=['annual member','short-term pass holder']) error thrown is: attributeerror: 'numpy.ndarray' object has no attribute 'start' edit: posting completed code: %matplotlib inline import matplotlib.pyplot plt import pandas pd import numpy np import seaborn sns; sns.set() trips = pd.read_csv('2015_trip_data.csv&

ember.js - How can we use store in Ember 2.x -

i upgrading app ember 1.10 2.2. have used store in 1.10 , working fine there, when try copy in 2.2, gives me error because of store. there specific way initialize store not able store time. in controllers, not data of store available. please help

java - Is there any way to know the type of an Object? -

the scenario passing object parameter in method , want perform operations based on type of object within method. sample code is: method(object object){ //if object== string type print string } try if (object.getclass().getname().equals("class1name")) //do something. the advantage of getclass instead of instanceof not need know class type @ compile time.

String to Date Parsing Java -

i trying parse utc timezone in date, first formatting simpledateformat , passing "utc" in formatter timezone. problem when trying parse string date, again change time without utc format. private date getdateutc_converter(date datestring) { simpledateformat formatter = new simpledateformat("eee mmm dd hh:mm:ss z yyyy"); formatter.settimezone(timezone.gettimezone("utc")); // datestring = mon feb 01 13:00:00 gmt+04:00 2016 date value = null; try {// mon feb 01 13:00:00 gmt+04:00 2016 // after utc mon feb 01 09:00:00 +0000 2016 string abc = formatter.format(datestring); value = formatter.parse(abc); // after getting mon feb 01 13:00:00 gmt+04:00 2016 here. } catch (parseexception e) { e.printstacktrace(); } return value; } don't format input string. parse straight away. private date getdateutc_converter(string

Recursively menu build in php -

i have stored menu below. id label link parent ------ ------- -------------- -------- 10 home http://cms.dev 10 11 http://about 11 12 history http://history 11 13 mission http://mission 11 14 contact http://contact 14 how can generate ul html menu recursively table unlimited item. home history mission contact what recursive function? when function calls itself. in case, items of every node looks recursive structure. yes, have tree , tree may bypass in recursive maner. so, recursively. example, if have plain array $menu items: $menu = [ [ 'id' => 10, 'label' => 'home', 'link' => 'http://cms.dev', 'parent' => 10, ], [ 'id' => 11, 'label' => 'about', 'link' => 'http://about', 'paren

concurrency - Task chaining in JavaFX8: Start next Task after onSucceeded finished on previous task -

i'm rather new javafx8 , facing following problem in current app document processing/editing. have 2 rather expensive tasks, namely opening e document , saving document. my app has buttons "import next", "export current" , "export current , import next". import , export, have 2 task of following structure: private class export extends task<void> { public export() { this.setonrunning(event -> { // stuff (change cursor etc) }); this.setonfailed(event -> { // stuff, eg. show error box }); this.setonsucceeded(event -> { // stuff }); } @override protected void call() throws exception { // expensive stuff return null; } } i submit task using executors.newsinglethreadexecutor(); . for functionality "export current , import next", goal submit export , import tasks executor, import tasks should run i

android - How to use functonal of ViewBinder in SimpleExpandableListAdapter? -

in app need override viewbinder of listview simpleadapter. need use expandablelistview cant figure out how realize functional? there no viewbinder. googling give no result. not interested in solution, or obvious did not notice?)

python - Always print multiple error lines -

i'm busy working on tool tagging documents. can't seem solve issue im having. see code below, these 2 functions small part of code: def runsearch(): time.sleep(1) #checkt of de lengte van de list keywords groter dan 0, zo niet, moet je eerst keywords opgeven if len(keywords) > 0: path_input = raw_input('give path check documents(e.g. /users/frank/desktop): ') errcounter = 0 #hier word gekeken of de opgegeven directory bestaat if os.path.isdir(path_input): root, dirs, files in os.walk(path_input): file in files: fullfile = os.path.join(root, file) if os.path.splitext(fullfile)[1].lower() == ('.docx') or \ os.path.splitext(file)[1].lower() == ('.doc') or \ os.path.splitext(file)[1].lower() == ('.pptx') or \ os.path.splitext(file)[1].lower() == ('.txt') or \

ubuntu - Error uploading Arduino Mirco Sketch using Kubuntu -

i have arduino micro want program kubuntu 15.10 system. installed arduino software using apt-get, when try upload program (for test purpose use basics\bareminimum sketch) following error: found programmer: id = "0.00 v1"; type = software version = 0..; hardware version = 0.0 avrdude: error: buffered memory access not supported. maybe isn't butterfly/avr109 avr910 device? the proper device "arduino micro" selected , proper port "/tty/acm0". found people on internet have same error , solve using usb port or cable. tried 2 different cables , different ports , didn't manage working. tried on laptop running older version of kubuntu produced same error. therefore tried newest version of arduino software arduino homepage. different error: avrdude: ser_open(): can't open device "/dev/ttyacm0": device or resource busy avrdude: ser_send(): write error: bad file descriptor my user added dialout group, should have access port.

not found RokSprocket Module in after installing in joomla -

when go extensions->manager found roksprocket module, when trying access extensions->manager did not see module , did not find model. can help? you should after installing module,go module manager>your module setting, should there set position of module according template.and menu publish change activated. goodluck

php regex how to remove duplicate strings -

here long string like"abc,adbc,abcf,abc,adbc,abcf" i want use regex remove duplicate strings seperated comma the following codes, result not expect. $a='abc,adbc,abcf,abc,adbc,abcf'; $b=preg_replace('/(,[^,]+,)(?=.*?\1)/',',',','.$a.','); echo $b; output:,adbc,abc,adbc,abcf, it should : ,abc,adbc,abcf, please point problem. thanks. you can tyr this- $a='abc,adbc,abcf,abc,adbc,abcf'; $pieces = explode(",", $a); $unique_values = array_unique($pieces); $string = implode(",", $unique_values);

xml - How to remove the "new" prefix from several attributes of the element in the request to the SOAP service? -

Image
i have wsdl. using wsdl2java have created java classes , add realization. after created project in soap ui receive next xml request: the problem have hardcoded client use 1 of operation of web sevice , client not work if new prefix exist. how remove new prefix login , password attributes of authdata element? update when call web-service that: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sin="http://my.comp/2010/webservice/service" xmlns:new="http://www.webservice.namespace"> <soapenv:header/> <soapenv:body> <sin:authdata> <!--optional:--> <new:login>121212</new:login> <!--optional:--> <new:password>12121</new:password> </sin:authdata> </soapenv:body> </soapenv:envelope> it works fine. when delete prefic new receive thw mistake: <soap:envelope xmlns:soap="

javascript - How do i achieve a jellybean 4.2 type menu in QML? -

hi watched review of nexus 7 , trying acheive similar kind of app menu in qml(where apps listed).can direct me in right direction? current code: grid{ id:gridpanel; rows:__itemsperpage; flow:flow.toptobottom; onxchanged:{ if(x > 0) x = 0; } behavior on x { id:listanimation enabled: false; animation: sequentialanimation { running: parent.enabled; numberanimation { target: gridpanel; property: "x"; duration: 300 } numberanimation { target: gridpanel; property: "scale"; to: 0.3; duration: 500; } pauseanimation { duration: 200 } numberanimation { target: gridpanel; property: "scale"; to: 1; duration: 500; } } } }

cloudflare showing original ip of sub-domain or if you type anything like asdlasd.domain.com -

i have domain, when open domain redirects https:// fine when type alsdkalsdsda.domain.com not redirect https:// , main problem when search domain original ip, can find typing of subdomain. (rtwrwrwerwq.domain.com) any solution thanks in advance sounds have wildcard record --> * in place, cloudflare not proxy unless you're using enterprise level plan. i'd encourage open support ticket cloudflare's support team though can review specific account settings further.

android - Hide apk file such that no one can download it from play store using web? -

i need know how hide apk file no 1 web can download apk file using apk downloading websites e.g https://apkpure.com , on. i don't think there way prevent users download apk file. best solution guess obfuscate it. :)

How can HierarchyViewer tool of android studio know the properties of views of android screen -

i want know how hierarchyviewer tool works in android. android app runs in different processes, how can know layout of views. pushes views , properties hierarchyviewer. which service of android push data hierarchyviewer tool. can please explain me please? lets first @ how adb organized. has 3 main components described here - client - clients running on machine being used development. client invoked shell issuing adb command. hierarchy viewer creates adb client. server - server runs background process on development machine.it communicates commands issued adb client adbd(adb daemon). adbd - adb daemon runs background process on each emulator or device. adb daemon responsible communication of data emulator or device adb server. adb daemon communicates various services running on device via binder ipc mechanism. for example when issue command adb install example.apk on shell. first invokes adb client on machine , tells wants install example.apk. server sends a

database - How to create a dataset in android? -

brief problem statment . im trying find best way offload in dataset or datable rows of pre-existing sqlite database located in assets folder. there lot of tutos in web external database management in android of them work 1 column , using lists instead of kind of dataset objects. what trying do... . have table in database, lets conformed 50 rows , 5 columns. need offload rows , columns in object , after that, assign object source of gridview. in every gridview cell ill show icon (that must open activity) , under icon description (extracted database). if user clicks on 1 of icons, app launch activity using information extracted database. i hope clear, if didnt please dont hesitate in ask me more details. dont want guys work, tips or "north" help, open mind. thank in advanced

javascript - While assigning a function to a variable in JS, why does it gets executed automatically? -

i come python background, , partially understand concept of functions being first class objects in python , javascript. but behaviour looks unusual me: $ node > function calc(){console.log('hey');}; > var = calc() hey the () in sample [var = calc();] means want invoke function. if want assign function variable should - var = calc; then, if want invoke can use a();

XPages: Generate CSV file and attach to mail -

i'm trying generate csv file (specifically .ics) , attach email. email composed via ssjs-function. opportunity generate csv file, save document , attach email . i tried generate csv file via xagent in xpage (like http://www.wissel.net/blog/d6plinks/shwl-8248mt ) , handle of output, no success. do know possibility manage this? any appreciated! thanks in advance! you looking @ 2 tasks: create csv / ics file send attachment for #1 can use stringbuilder or printwriter or whatever. ics file not csv file, icalendar format. generate highly recommend ical4j . in case whatever write -> don't create file. use printwriter (for csv) uses bytearrayoutputstream (or directly ics4j), result bytearray in memory. for #2 1 mental step must make away "the notes way" trying deal embedded objects etc. create mime message (there snippets on openntf) , create mimepart. there can use setcontentfrombytes , have attachment. pro tip (to make life easier): cr

android - java.lang.NoClassDefFoundError com.sun.jersey.api.client.Client -

03-13 08:10:19.621: e/androidruntime(800): java.lang.noclassdeffounderror: com.sun.jersey.api.client.client why im getting exception?though have added jars. add used libraries in application manifest: <uses-library android:name="your library" /> edit: btw. make sure have added jersey-core classpath too, dependency com.sun.jersey.api.client.client.

javascript - How to give each div created from setInterval an id starting from 1 -

i know question might have been answered few times, cannot seem work in code. willing thank you. i have object creates rectangle on screen run setinerval recreate rectangle on screen in order many rectangles shown 1 after other on screen. the problem: need give each rectangle id, don't know jquery , if implement attr on .block jquery changes id's of divs. i want each new div created have own id example id=block1 next div id=block2 , on , of them of class block. var cheight = window.innerheight - 150; //size of block var cwidth = window.innerwidth - 150; var block = function(block) { this.block = document.createelement('div'); this.block.classname = 'block'; document.body.appendchild(this.block); } block.prototype.coordinates = function(top,left) { this.block.style.top = top + 'px'; this.block.style.left = left + 'px'; } block.prototype.size = function(width,height) { this.block.style.width = width + &#

Is a webcam feed inside of emacs possible? -

i want live stream me coding on twitchtv. in vim days, open several terminals , leave small hole in corner put quicktime webcam display screen recorder capture face. ability embed webcam feed buffer of emacs integrated emacs tiling ability. possible? if so, how go doing it? take answer grain of salt, it's untested , i'm not sure if works, , won't audio. create live-streaming .gif file video stream: git clone https://github.com/jbochi/gifstreaming cd gifstreaming mkdir input mkdir parts ffmpeg -re -i rtmp:///dev/video0 -pix_fmt pal8 -s 159x97 -r 10 input/in%d.gif & python transform.py node server.js https://github.com/jbochi/gifstreaming open buffer image displayed inline using emacs web browser: m-x eww ret http://localhost:8080/ ret alternatively, try streaming directly webcam without gif step, doubt eww can display video files inline. http://www.area536.com/projects/streaming-video/

iphone - Selecting Tabbar item in iOS -

my app has #hashtags can selected. we have 3 tabs in our tabbar, mainvc, profilevc , tagvc. tagdetailvc typically accessed via tagvc. when user selects tag, directed tagdetailviewcontroller. edit hooked tabbarcontroller on storyboard. right have this: tagdetailviewcontroller *dest = [[tagdetailviewcontroller alloc] init]; uinavigationcontroller *nav = [self.tabbarcontroller.viewcontrollers objectatindex:2]; [nav pushviewcontroller:dest animated:yes]; however, seeing right tagvc. placed log statement in viewdidload in tagdetailvc , did not show. for record, how story board organized: tabbarcontroller -> navigationvc -> mainvc ... -> navigationvc -> profilevc ... -> navigationvc -> tagvc -> tagdetailvc i interested have tabbar select tagvc , push tagdetailvc onto navigationcontroller of tagvc. behavior expecting when user presses tag is: 1. tab selected @ tagvc 2. tagdetailvc pushed onto navigationvc of tag

knockout.js - Is it possible to inject values from the KO view model to a template? -

would understand whether it's possible inject values view model in template out using "data-bind" using knockout js. for example, if have following view model; var myviewmodel = { var self = this; self.firstname = ko.observable("abc"); self.lastname = ko.observable("xyz"); }; i need create template following; <script id="myinjecttemplate" type="text/html"> <h3 id="header_${firstname}">${firstname} - ${lastname}</h3> </script> where inject values in view model place holders, in apache velocity ? thanks. you can set id using data binding too, know, can both: <h3 data-bind="attr: { id: 'header_$' + firstname() }, text: firstname() + ' - ' + lastname()"></h3> though i'd @ using computed observable create full name first , last name observables.

c# - Reliable connection with Azure SQL Database -

i developing c# application storing data in azure sql database. as know, azure sql database placed somewhere on internet. not on lan network (but question relevant reliable network lan). i've noticed time-to-time i'm getting errors "connection closed" (or network errors). it's easy simulate clumsy . reasons errors bad network conditions. so, first idea solve "try again". when getting error, try again , it's working good. magic. this maybe solving problem, but, open kind of problems . not situations solution. i'll explain: i'll separate scenarios 2 types: retry cant make damage - operation select or delete. retrying have same expected result. so, type of problems - solution working fine! insert or update - retry damage information. i'll focus the point number 2 . example, let's have: a users table. columns in table: id, username, credits. store procedure make user (by user id) pay of credits. the "pay&q

javascript - How to make the comments appear in the popup in Rails 3? -

update i have popup working, i'm having issues code. how can display comments associated post in popup? please refer below code have view. i decided using popups easiest way solve current formatting issues. basically, have "comments" under each post. instead of having them show below post, i'd have them come in popup when link "x comments" clicked. reason that, can't formatting correct when try have them appear underneath. here's link have # of comments in view clicked popup <a href="#" id="comment_count"><%= micropost.comments.count.to_s %> comment </a> i'll implement pluralizing of text later. this code comments associated each post. <div class ="itemcomments"><% if post.comments.exists? %> <% post.comments.each |comment| %> <%= image_tag("http://www.gravatar.com/avatar.php?gravatar_id=#{digest::md5::hexdigest(comment.user.email)}") %> &

javascript - Adding SlideUp and slidedown animation on replaceWith in jQuery -

i making app showcase site. have page full width vertical slides . added fixed phone on screen. want add image on phone when user slide using button. when press button jquery remove current image phone , add new image in sliding manner. have found tutorial on codyhouse https://codyhouse.co/demo/app-introduction-template/index.html#cd-product-tour . it's tutorial not able in vertical way. code of slides <div id="allslides"> <div id="1" class="slides" phone_image='its url of image going added on phone when slide active '> <h1>my appp</h1> <p class='content'>some content</p> </div> <div id="2" class="slides" phone_image='its url of image going added on phone when slide active '> <h1>my appp</h1> <p class='content'>some content</p>