Posts

Showing posts from June, 2011

java - How can get numbers between brackets ([ ]) in a string -

i have string it: string msg = "[05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16]"; and need numbers between brakets in array. can me? pseudo code: string replace '[' '' string replace ']' '' string split @ ' '

java - Gradle and Maven compile my project but I am getting NoClassFoundError -

i trying compile project uses gradle , maven. project use library on local maven repository. library referenced in gradle , maven: gradle: dependencies{ compile 'cf.charly1811.java.utils:mimetype:1.0' } maven: <!-- dependencies --> <dependencies> <dependency> <groupid>cf.charly1811.java.utils</groupid> <artifactid>mimetype</artifactid> <version>1.0</version> </dependency> </dependencies> when try compile project using mvn clean package or gradle clean jar success. error arises when mimetype class called: exception in thread "thread-4" java.lang.noclassdeffounderror: cf/charly1811/java/utils/mimetype @ cf.charly1811.java.web.requesthandlerthread.process(requesthandlerthread.java:120) @ cf.charly1811.java.web.requesthandlerthread.handlerequest(requesthandlerthread.java:85) @ cf.charly1811.java.web.requesthandlerthread.ru...

powershell - What is conceptually wrong with get-date|Write-Host($_) -

i'm trying understand powershell, find somethings not intuitive. understand of in pipeline objects passed, instead of traditionally text. , $_ refers current object in pipeline. then, why following not working: get-date|write-host "$_" the errormessage is: write-host : input object cannot bound parameters command either because command not take pipeline input or input , properties not matc h of parameters take pipeline input. @ line:1 char:10 + get-date|write-host $_ + ~~~~~~~~~~~~~ + categoryinfo : invalidargument: (10-9-2014 15:17:00:psobject) [write-host], parameterbindingexception + fullyqualifiederrorid : inputobjectnotbound,microsoft.powershell.commands.writehostcommand $_ current single item in pipeline. write each item in pipeline write get-data | foreach { write-host $_ } or in short form get-data |% { write-host $_ } conceptually, foreach cmdlet receives function parameter, pipeline input , applies function o...

Does Excel VBA object model allows for access to keyboard shortcut to VBA IDE menu items? -

Image
does excel vba object model allows access keyboard shortcuts vba ide menu items ? (i create additional item in menu , connect choosen shortcut) for example code below returns "c&lear" means can access "clear" item typing "l" when "edit" group in vbe ide active, can access "clear" typing "delete" button alone : debug.print application.vbe.commandbars(1).controls(2).controls(6).caption is there way find pragrammaticaly direct shortcut item in ide menu ("delete" in case above) ? add item vba ide menu new custom shortcut ? debug.print application.vbe.commandbars(1).controls(3).controls(6).caption returns "&immediate window" access immediate window direct shortcut "ctrl+g" is there way find pragrammaticaly direct shortcut item in ide menu ("delete" in case above) yes, there is. try this debug.print application.vbe.commandbars(1).controls(2).controls(6).s...

sql server 2008 - MSSQL store procedure is executing twice in PHP PDO -

i have block of code getting executed twice when post hits payment gateway.any welcome on issue. have checked code there no 404 resuest script. $stmt = $dbadapter->prepare('exec myprocedure ?,?,?,?,?,?,?,?'); $stmt->bindparam(1,$id, pdo::param_int); $stmt->bindparam(2,$transaction, pdo::param_str); $stmt->bindparam(3,$person_id, pdo::param_str); $stmt->bindparam(4,$amount); $stmt->bindparam(5,$orderid, pdo::param_str); $stmt->bindparam(6,$bankclientid, pdo::param_str); $stmt->bindparam(7,$transaction_time, pdo::param_str); $stmt->bindparam(8,$status, pdo::param_int); $id = $stmt->execute();

jquery - How can i run php script when page is fully loaded -

i fetching tweets , showing them slider . when open page shows me tweets 1 above create mess. , after page loaded shows me tweets wanted . there way show tweets or run php code when page loaded ? it sounds tweets output via php, , styled slider javascript, in between data being output , javascript loading, see unstyled data. a simple solution give containing element style of display:none, show via javascript when page has loaded: css #tweet-holder{ display:none; } php / html <div id="tweet-holder"> //all tweets go here </div> js $(function(){ $('#tweet-holder').show(); });

java - Unable to login to AD account with given password -

we have set accounts users temporary passwords. user receives password through email , suppose able log in it. have since fixed our previous problem of our passwords not meeting ad requirements , using defaults testing. here error receive in console. please let me know if there else can supplied. thanks: console 2014-09-10 13:25:32,685 [ajp-0.0.0.0-8009-4] error com.util.adutil - error building user attributes java.lang.numberformatexception: input string: "exampletest" @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65) @ java.lang.integer.parseint(integer.java:492) @ java.lang.integer.parseint(integer.java:527) @ com.example.publicwebsite.example.account.util.adutil.buildaccount(adutil.java:742) @ com.example.publicwebsite.example.account.util.adutil.searchforusers(adutil.java:841) @ com.example.publicwebsite.example.account.util.accountutil.searchforusers(accountutil.java:157) @ org.apache.jsp.public_.exa...

java - How to make JAXB call the setter AFTER adding Elements to an List? -

i have data in xml-file want unmarshal jaxb myhashmap. myobject has string name, key in hashmap. to prevent writing key/name information twice xml-file (once name of myobject , once key of myhashmap), added setter , getter arraylist, add/read data into/out of myhashmap. @xmlrootelement public class myhashmap extends hashmap<string, myobject> implements serializable { public myhashmap() { super(); } @xmlelement(name = "myobject") public void setmyobjectsarraylist(arraylist<myobject> myobjectlist) { (myobject myobject : myobjectlist) { this.put(myobject.getname(), myobject); } } public arraylist<myobject> getmyobjectsarraylist() { if (this.isempty()) { // added setter called return null; } arraylist<myobject> myobjectlist = new arraylist<myobject>(); myobjectlist.addall(this.values()); return myobjectlist; } } it worked f...

javascript - How to trigger a popup message on click the close button of a jqueryui window? -

i want trigger message on click on close button of jqueryui window. see jqueryui window here. want give confirmation message on click close button. http://jqueryui.com/dialog/#modal-message any idea? attach event listener on beforeclose event: $("#dialog").on("dialogbeforeclose", function(event, ui) { // stuff, presumably return false prevent closing dialog });

java - what's the class Hibernate uses internally to format SQL output? -

we know sql output formatting can enabled set attribute true in xml configuration file when using hibernate. , want know name of class or classes hibernate uses internally. it because working on old project, developers hard-coded sql statements dao classes , crammed complicated ones few lines, makes them hard read , understand. i can extract original sqls stringbuffer or plain string concatenation structures, still need format them me. can of low accuracy, @ least can recognize key words select, from, join, union etc. the interface org.hibernate.jdbc.util.formatter implemented classes org.hibernate.jdbc.util.basicformatterimpl , org.hibernate.jdbc.util.ddlformatterimpl (at least in versions 3.3.0 through 4.3.6).

python - Django Celery email, celery is not working -

i working on django celery sending regsitration email ,but celery not working correct. my error in celery [2014-09-10 19:11:44,349: warning/mainprocess] celery@jeet-pc ready. [2014-09-10 19:13:38,586: info/mainprocess] received task: apps.kashmiri.tasks.signuptask[17ca2ae1-8c72-426c-babd-470a55ac19 5] [2014-09-10 19:13:38,936: error/worker-1] pool process <worker(worker-1, started)> error: runtimeerror(runtimeerror("app reg stry isn't ready yet.",), <function model_unpickle @ 0x034e4b30>, (('auth', 'user'), [], <function simple_class_factory @ x034e4af0>)) traceback (most recent call last): file "c:\python27\lib\site-packages\billiard\pool.py", line 289, in run sys.exit(self.workloop(pid=pid)) file "c:\python27\lib\site-packages\billiard\pool.py", line 350, in workloop req = wait_for_job() file "c:\python27\lib\site-packages\billiard\pool.py", line 441, in receive ready, req = _receive(1...

android - How do i get the position of a URL in an array? -

what i'm trying achieve obtain url received instagram , pass array position onlick listener each corresponding photo in grid view. here code: mainactivity.java public class mainactivity extends activity { private instagramsession minstagramsession; private instagram minstagram; private progressbar mloadingpb; private gridview mgridview; private static final string client_id = "83549f9eb76f4a5b90daf6e4e14da107"; private static final string client_secret = "6df26b0c8f664323a07126bfe8511651"; private static final string redirect_uri = "http://www.yahoo.com"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); minstagram = new instagram(this, client_id, client_secret, redirect_uri); minstagramsession = minstagram.getsession(); if (minstagramsession.isactive()) { setcontentview(r.layout.activity_user); instagramuser instagramuser = minstagramsession.ge...

oop - Domain Model for Simple Use case -

Image
i trying learn domain modeling , lets consider shopping cart example.lets user can browse catalog of products , add products shopping cart, purchase products.to purchase products place order.user can trace order details.he can call customer rep know status of order. please validate domain model in full scope. below domain model have designed , having issues in representing order , order status right way how link product , order. a (conceptual) domain model solution-independent description of problem domain produced in analysis phase of software engineering project. may consist of information models (typically in form of uml class diagrams), process models (typically in form of bpmn diagrams), , possibly other types of models. a domain class model contains conceptual elements, such properties (possibly without datatypes) , associations . not specify visibility of properties , methods, visibility platform-specific concept. your model incomplete in many respects (...

c# - Webservice Response without Soap Wrapper -

whenever call webservice in response include response soap wrapper in it. there way can return webservice response without soap wrapper. e.g. soap response looks like: <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:body> <getemployeelistresponse xmlns="http://test.com/employee/"> <getemployeelistresult> <employeelookup> <employee> <id>123</id> <name>john</name> </employee> <employee> <id>325</id> <name>henry</name> </employee> </employeelookup> <...

Double click ps1 file and powershell window disappears -

i checked here , there topics talking double clikc ps1 file run. situation have ps1 file opening remote session this: $pw = convertto-securestring -asplaintext -force -string xxxxxx $cred = new-object -typename system.management.automation.pscredential -argumentlist "xxxx\admin",$pw $pc = read-host -prompt "please enter pc name" $session = new-pssession -computername $pc -credential $cred enter-pssession $session and tried this way make double click run, powershell.exe -command "& 'c:\a path spaces\myscript.ps1' -myarguments blah" after entered pc name, console disappears.... any idea why? did try -noexit option? powershell.exe -noexit -command "& 'c:\a path spaces\myscript.ps1' -myarguments blah"

.net - Combinatorial data in xUnit.NET? -

i'm migrating mbunit xunit, , i'm trying locate equivalent attributes (or approach) mbunit's [combinatorialjoin] , [column] . for example, when testing common behavior of function multiple boolean parameters, [column] makes easy test permutations: public void testmethodwithtoomanyoptions([column(true, false)] bool dispose, [column(true, false)] bool usedestinationstream, [column(true, false)] bool usecorruptedsource, [column(true, false)] bool loadtwice, [column(true, false)] bool usesourcestream) { [combinatorialjoin] , [sequentialjoin] , [pairwisejoin] affect how columns (or rows) permuted. this perhaps correct response... https://github.com/aarnott/xunit.combinatorial

c - How can I set the size of char [] with int -

i want create char foo[] , set size wit int dosn't work @ all! }else{ int start = match[1].rm_so; int end = match[1].rm_eo; char value[end-start]; ... } the size of value 0, why so? thanks you should use malloc that. char *value = malloc( (end-start) * sizeof(char)) when using malloc, remember free memory when done using array. free(value) see more here if need more information please : c dynamic memory allocation

database - writing cell array into text file and managin the variables in import wizard -

Image
i have cell array of matrices my_cell = [3 x 3] [3 x 3] [3 x 3] after writing text file dlmwrite , need import data import wizard in way my_cell(1,1) first variable, my_cell(1,2) second , my_cell(1,3) third one. this code: v = [r1 k1 d1 ;r2 k2 d2 ; r3 k3 d3]; mycell = cell(1,3); mycell{1,1} = [r1 k1 d1 ;r2 k2 d2 ; r3 k3 d3]; mycell{1,2} = ones(3); mycell{1,3} = zeroes(3); mat = cell2mat(mycell); dlmwrite('datas.txt', mat ,'precision','%.5f'); and result after importing this: is there way make such table desire? here's how you'd it: x = dlmread('datas.txt'); % note data plural. datum singular! y = mat2cell(x, 3, [3 3 3]) mat2cell reverse operation of cell2mat given dimensions.

playframework 2.0 - How can use a differently named JPA Config instead of "default"? -

i have setup config called "staging" - in application.conf along lines of this: jpa.staging=oraclepersistenceunitstaging db.staging.driver=oracle.jdbc.oracledriver db.staging.url="jdbc:oracle:thin:@localhost:1521:xe" db.staging.user=udrtnsm db.staging.password="kldj90fdkl" db.staging.jndiname=oracledsstaging evolutions sets connection , applies scripts, first request application shows: play.api.application$$anon$1: execution exception[[runtimeexception: no jpa entitymanagerfactory configured name [default]]] @ play.api.application$class.handleerror(application.scala:293) ~[play_2.10.jar:2.2-snapshot] @ play.api.defaultapplication.handleerror(application.scala:399) [play_2.10.jar:2.2-snapshot] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$2$$anonfun$applyorelse$3.apply(playdefaultupstreamhandler.scala:261) [play_2.10.jar:2.2-snapshot] @ play.core.server.netty.playdefaultupstreamhandler$$anonfun$2$$anonfun$applyorelse$3.apply(pla...

ruby on rails - No route matches missing required keys: [:id] -

i'm new rails, , editing code written else, may need more in-depth response average person... i'm running error when run rake: no route matches {:controller=>"users", :action=>"show", :id=>nil, :format=>nil} missing required keys: [:id] the line appears causing problem this: <%= link_to("my account", user_path(current_user)) %> the link works correctly on localhost, failing test @ line "render :template": it "renders new initiative form" assign(:initiative, initiative.new(location: location.new,rewards: [factorygirl.create(:reward)])) render :template => "initiatives/new.html.erb" (...etc.) not sure else helpful include here, userscontroller is: class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end end and results rake routes: `batch_action_admin_users post /admin/users/batch_action(.:format) admin/us...

bash - Can anyone tell me what :x: is used for? -

Image
could tell me :x: used for? i've searched web not many results. example following: `grep $user:x: /etc/passwd' thanks, dave $user:x: pattern give grep search in /etc/passwd . return lines containing $user:x: , $user user working in shell. hence, command return line in /etc/passwd in user defined. if check how /etc/passwd file stored see 2nd block x , meaning password encrypted , stored in /etc/shadow file. in old machines password stored in /etc/passwd , changed because file readable user, while /etc/shadow root. that said, using $user:x assure matching user. in fact, ^$user: suffice, because : cannot present in user name. an alternative use awk example: awk -f: -v user=$user '$1==user' /etc/passwd see graphical explanation of /etc/passwd (sorry bit big!! couldn't find other smaller in english):

html5 - Is legend in header valid ? <h1><legend> Caption </legend></h1> -

i know if insert legend inside header. way legend can have hierarchy related whole document. i have more text below relevant needs highlighted readers. in case personal information legend , h2 @ same time. h1 element in site chose not display. <fieldset> <h2> <legend>personal information</legend> </h2> <h3> credentials </h3> <label for="username"> username </label> <input id="username" type="text"> <label for="surname"> surname </label> <input id="surname" type="text"> <h3> contact details </h3> <label for="street"> street </label> <input id="street" type="text"> <label for="house-number"> house number </label> <input id="house-number" type="number"...

java - How to only allow links in a webView to be opened by other applications? -

making android app loads url in webview webpage contains links images , videos not want opened within webview, if user clicks on link doesn't load 1 of whitelisted links want prompt user open link in android web browser or google chrome. so far have this: public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); string url = "http://myurlhere.com"; webview view = (webview) this.findviewbyid(r.id.webview1); view.getsettings().setjavascriptenabled(true); view.setwebviewclient(new webviewclient()); view.loadurl(url); string currenturl = view.geturl(); if (currenturl != url) { view.loadurl(url); } } but still allows links opened in webview.

c++ - How to compare the value inside of an array -

so im writing program asks user input number of pancakes person(1-10) had breakfast. program must analyze input , determine person ate pancakes. program must output list in order of number of pancakes eaten of 10 people. far have written code user input , code display array, not in order. im lost when comes comparing elements in array: int getpancakes(); void displayarray(int thearray[],int sizeofarray); void comparearray(int sizeofarray); int pancakes[10]; int z = 0; int main() { } int getpancakes(){ int y; int x = 0; for(int y = 0; y < 10; y++){ ++x; cout << "how many pancakes did person " << x << " eat?" << endl; cin >> pancakes[y]; } } void displayarray(int thearray[],int sizeofarray){ for(int x = 0 ;x < sizeofarray ; x++){ ++z; cout << "person " << z << " ate " << pancakes[x] << " pancakes" <...

node.js - SailsJS One to Many associations -

hi i'm building sails app couple of models in 1 many configuration. i've been able create new instances of models via relationship, seems working 1 way. for reference (one) project can have (many) users. /** projects.js **/ name: { type: string }, managers: { collection: 'users', via: 'projects' } /** user.js **/ username: { type: 'string' }, projects { { model: 'projects' } using following create method, results in user have reference project, no reference user available project. managers reference array of user ids. project.create({ name: req.param('name'), managers: req.param('managers') }).exec(function newproject(err, results) { if (err) return res.json({ error: err }); return res.json({ results: results }); }); and retrieve projects respective managers: project.findone({ id: req.param('id') }).populate('managers').exec(function project(err, results) { if (er...

sql - Insert row in a table from an other database with conditions -

i have 2 databases, same structures not same datas, i'm trying insert datas source database target database, when datas don't exist in target (if exist update it, it's working). this i've done : insert table select * table@source not exists ( select * table@source ts ts.id=table.id , ts.id2=table.id2 ) but doesn't work... can me please ? exemple of want request : target : id-id2-num 01-001-100 -> updated 02-002-200 -> deleted 04-004-400 -> deleted source : id-id2-num 01-001-111 -> used update target 02-001-020 -> added in target 03-003-300 -> added in target the update , delete part work fine. i'm having troubles add line part. ok, i've found error : insert table select * table@source not exists ( select * table tt tt.id=table.id@source , tt.id2=table.id2@source )

python - Best Way To Unpivot a Pandas Dataframe -

i have data missing values on weekends, public holidays etc. datadate | id | value ----------------------- 1999-12-31 | 01 | 1.0 1999-12-31 | 02 | 0.5 1999-12-31 | 03 | 3.2 2000-01-04 | 01 | 1.0 2000-01-04 | 02 | 0.7 2000-01-04 | 03 | 3.2 and want copy values down on dates data missing. so, i've pivoted frame, re-indexed, , copied values down. datadate | 01 | 02 | 03 ---------------------------- 1999-12-31 | 1.0 | 0.5 | 3.2 2000-01-01 | 1.0 | 0.5 | 3.2 2000-01-02 | 1.0 | 0.5 | 3.2 2000-01-03 | 1.0 | 0.5 | 3.2 2000-01-04 | 1.0 | 0.7 | 3.2 now want return data original form. i've tried using pd.melt() , , df.unstack() , i'm ending more columns want, , constructing new data frame result taking long time. is there better way unpivot data ? there pandas.pivot_table function , if define datadate , id indices, can unstack dataframe. that'd be: from io import stringio import pandas datatable = stringio("""\ datadate ...

image processing - Face recognition in MATLAB -

i having error, saying: subscripted assignment dimension mismatch. error in facerecognition (line 14) images(:, n) = img(:); can help? code have written below: input_dir = 'd:\c.s\fyp\matlab projects\dip applications\face recognition\faces\'; image_dims = [48, 64]; filenames = dir(fullfile(input_dir, '*.jpg')); num_images = numel(filenames); images = []; n = 1:num_images filename = fullfile(input_dir, filenames(n).name); img = imread(filename); if n == 1 images = zeros(prod(image_dims), num_images); end images(:, n) = img(:); end % steps 1 , 2: find mean image , mean-shifted input images mean_face = mean(images, 2); shifted_images = images - repmat(mean_face, 1, num_images); % steps 3 , 4: calculate ordered eigenvectors , eigenvalues [evectors, score, evalues] = princomp(images'); % step 5: retain top 'num_eigenfaces' eigenvectors (i.e. principal components) num_eigenfaces = 20; evectors = evectors...

java - Sending the notifications from service -

the implementation of notification sending work if send activity , nothing happens if send service. can suggest possible solutions? thanks here service implementation.......... public class myservice extends service { private notificationmanager notificationmanager; private dbhelper dbhelper; private sqlitedatabase db; private context mcontext = this; private int notificationid = 100; @override public void oncreate() { log.i("mylogs", "service: oncreate()"); super.oncreate(); dbhelper = new dbhelper(this); db = dbhelper.getwritabledatabase(); notificationmanager = (notificationmanager)getsystemservice(notification_service); } @override public int onstartcommand(intent intent, int flags, int startid) { log.i("mylogs", "service: onstartcommand()"); simpledateformat dateformat = new simpledateformat("yyyy-mm-dd"); date date = new date(); string currentdatestring = dateformat.format(date); ...

spring mvc - How to avoid error with Injection of autowired dependencies in Java based configuration? -

i use java based configuration. when have had 1 userrepository bean, working fine. when added 1 implementation of userrepository, got error org.springframework.beans.factory.beancreationexception: error creating bean name 'answerservice': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: public com.springapp.mvc.service.newuserservice com.springapp.mvc.service.answerservice.userservice; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'newuserservice': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: public com.springapp.mvc.repository.userrepository com.springapp.mvc.service.newuserservice.userrepository; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no unique bean of type [com.springapp.mvc.repository...

d3.js - dc.js piechart legend: display only top 5 -

i generating piechart (doughnut chart precise) has around 50 items, top 5 of them accounts 95% of chart. when display legend info, overlapping chart, since there many legend items. wondering if there option limit legend display top 5 items. https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md#legend i not see option limit legend display top 5 or top 10. you can modify dc.js library can following in legend mixin: dc.legend = function () { ... //start modification var _maxitems; _legend.maxitems = function(maxitems) { _maxitems = maxitems; return _legend; }; //end modification ... _legend.render = function () { _parent.svg().select('g.dc-legend').remove(); _g = _parent.svg().append('g') .attr('class', 'dc-legend') .attr('transform', 'translate(' + _x + ',' + _y + ')'); var legendables = _parent.legendables(); //start modification if (_maxitems) { ...

Android Navigation Drawer Selector Color -

i trying change highlight color on navigation drawer fragment. have used pre-built project template navigation drawer. have searched site many different solutions far none of them have worked. currently, have: list_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@color/listbackground" android:state_activated="false"></item> <item android:drawable="@color/orangebackground" android:state_pressed="true"></item> <item android:drawable="@color/orangebackground" android:state_activated="true"></item> </selector> navigationdrawerfragment.java posting relevant mdrawerlist constructor/decleration. @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { md...

regex - How do I remove all excess whitespace from an XML string using ColdFusion? -

i receive xml string client in format following... <root> <result success="1"/> <userid>12345</userid> <classid>56543</classid> </root> i need compress string down following... <root><result success="1"/><userid>12345</userid><classid>56543</classid></root> so, of whitespace removed, except inside of tag (so space still exists between "result" , "success"). i have used replace statements remove line breaks, carriage returns, etc, can't remove spaces while ignoring spaces inside tags. there way use regular expression or other method accomplish this? the below regx match spaces not within tags, [\s]+(?![^><]*>) or [\s]+(?![^><]*(?:>|<\/)) just replace matched spaces empty string. demo edit starts here from comments - in context of coldfusion works this... strclean = rereplace(stroriginal,...

Dojo DGrid RQL Search -

i working dgrid want find search term in grid on 2 columns. for instance, want see if scientific name , commonname columns contain string "aca" (i want search case insensitive) my grid definition: var customgrid = declare([grid, pagination ]); var gridstore = new memory({ idproperty: 'tsn', data: null }); gridstore.queryengine = rql.query; grid = new customgrid({ store: gridstore, columns: [ { field: "tsn", label: "tsn #"}, { field: "scientificname", label: "scientific name"}, { field: "commonname", label: "common name",}, ], autoheight: 'true', firstlastarrows: 'true', pagesizeoptions: [50, 100], }, id); with built in query language (i think simple query language), able find term in 1 column or other, couldn't complex sear...

how do you subset R data frame based on provided column names via a function argument? -

i trying create r function based on given data frame first argument, subset data frame based on provided arguments: for example, df this: date server1 server2 server3 server4 1/1/2004 10 20 10 5 2/1/2014 4 4 4 20 3/2/2014 1 5 5 39 i need subset df: for example, if pass function(x, server1, server3, server4), this: data<-function(x, ...) { subset(x, select=c("server1","server3", "server4")) } but, argument list should not known. should apply data frames not knowing column names. any ideas how accomplish in r? if pass arguments strings should work fine this: subset2<-function(x, ...) { cols <- c(...) subset(x, select=cols) } subset2(dat, "server1", "server3", "server4") but i'm not sure why such wrapper necessary. perhaps missing true goal is?

.net - iTextSharp - Document has no pages when working with table -

dim doc new document() dim pdfwrite pdfwriter = pdfwriter.getinstance(doc, new filestream("invoice.pdf", filemode.create)) doc.open() dim table new pdfptable(6) table.widthpercentage = 110 dim celldate new pdfpcell(new phrase("9/10/14")) celldate.colspan = 2 table.addcell(celldate) dim cellcompany new pdfpcell(new phrase("company inc." & vbnewline & _ "sales person" & vbnewline & _ "123 s 150th road" & vbnewline & _ "somecity, na 12345" & vbnewline & _ "405.555.9999")) celldate.colspan = 2 table.addcell(cellcompany) dim cellinvoiceno new pdfpcell(new phrase("12345")) celldate.colspan = 2 table.addcell(cellinvoic...

mod rewrite - .htaccess How to Exclude One Site From SSL? -

i'm trying exclude 1 site using ssl, can't seem directive right. want addon domains use ssl except example.com. (because startssl difficult along with) # enable https rewritecond %{https} off #rewriterule (.*) https://%{http_host}:443%{request_uri} rewriterule !^example.com(/|$) https://%{http_host}:443%{request_uri} what you're trying not work. ssl handshake initialized before request data sent server, therefore, you're going certificate exception if goes https://example.com no matter do. if certificate exception isn't concern, need match against %{http_host} variable: rewriteengine on rewritecond %{https} off rewritecond %{http_host} !^(www\.)?example\.com$ [nc] rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] then if need: rewritecond %{https} on rewritecond ^{http_host} ^(www\.)?example\.com$ [nc] rewriterule ^(.*)$ http://%{http_host}%{request_uri} [l,r=301]

javascript - Get the first number value from a descendant inside a table -

i'm trying way first number value present inside table (and respective tbody), needs able find value first number, , ignores tags comes accross until reaches number value. <table id="tableid"> <thead></thead> <tbody> <tr></tr> <tr> <td></td> <td> <div> <div> <span> 4031007 </span> </div> <div> <span> whatever </span> </div> </div> </td> <td></td> </tr> </tbody> </table> in above example, try find 4031007, inside <span> , could've been <div> or else. nee...

clock - Windows 8 Time Changes Constantly -

on windows 8, timezone correct , it's connected internet. so, after reboot changes time though settings correct. how can fix it? you need synchronize system clock time server. go adjust date, , search in internet time tab option synchronize internet time server .

C++ storing custom object as blob in Mysql -

i need store c++ object mysql database blob. following code, int mysqldb::save(string name, trackerfeatures features) { ofstream ofs("features.ros", ios::binary); ofs.write((char*)&features, sizeof(features)); try{ sql::preparedstatement *pstmt = con->preparestatement("insert faces(name,features) values(?,?)"); istream stream(ofs.rdbuf()); pstmt->setstring(1, name); pstmt->setblob(2, &stream); pstmt->executeupdate(); } catch (sql::sqlexception &e) { cout << "# err: sqlexception in " << __file__; cout << "(" << __function__ << ") on line " << __line__ << endl; cout << "# err: " << e.what(); cout << " (mysql error code: " << e.geterrorcode(); cout << ", sqlstate: " << e.getsqlstate() << " )" << endl; } return exit_success; } ...

angularjs - Angular UI Router Set Scope/Variable -

i have angular app using ui router routing purposes. each time change router, change header of page, , seems $stateprovider easiest way that. have $stateprovider: $stateprovider .state('index', { url: "/", views: { "rightcontainer": { templateurl: "viewa.html" }, }, controller: function ($scope) { $scope.data.header = "header 1" } }) .state('details', { url: "/details", views: { "rightcontainer": { templateurl: "viewb.html" }, }, controller: function ($scope) { $scope.data.header = "header 2" } }); i want have header: <div data-ng-controller="mainctrl"> <div class='bg'>{{data.header}}</div> </div> you can use data https://github.com/angular-ui/ui-router/wiki#attach-c...

How does this fit in the "pass by value of refrences" in java? -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 72 answers in code below why foo2 null when printing data @ system.out.print? public class helper { public void shadowcopy(foo foo1, foo foo2){ foo2 = foo1; } public static void main(string[] args) { helper h = new helper(); foo foo1 = new foo(50); foo foo2= null; h.shadowcopy(foo1, foo2); system.out.println(foo2.data);// why java.lang.nullpointerexception? } public static class foo { public int data=0; public foo(int data){ this.data = data; } } } in shadowcopy , foo2 copied reference same object foo2 in main referring to. however, assigns local foo2 reference refer same object foo1 . doesn't change foo2 reference variable in main , remains...

ruby - SQLite3::SQLException: duplicate column name: User_id: ALTER TABLE "comments" ADD "User_id" integer/ -

i ran command rails g migration adduser_idtocomments user_id:string and figured out user_id should integer , ran rails g migration adduser_idtocomments user_id:integer --force thinking overwrite initial command. but now, i'm getting error: ``` louismorin$ rake db:migrate == 20140910155248 addindextocomments: migrating =============================== -- add_column(:comments, :index, :string) -> 0.0069s == 20140910155248 addindextocomments: migrated (0.0070s) ====================== == 20140910181022 adduseridtocomments: migrating ============================== -- add_column(:comments, :user_id, :integer) rake aborted! standarderror: error has occurred, , later migrations canceled: sqlite3::sqlexception: duplicate column name: user_id: alter table "comments" add "user_id" integer/users/louismorin/code/cp299/db/migrate/20140910181022_add_user_id_to_comments.rb:3:in change' activerecord::statementinvalid: sqlite3::sqlexception: duplicate ...

php - This page is taking too long to load -

i have created view page on php zend framework. view page has 10 methods. each method has 3 sql queries returning thee values. calling these 10 methods 10 times. queries working on table of 24,000 rows. it's taking 2-3 minutes load view page. storing function results in arrays , using array values display. how can implement output caching on this? source code view part is: variables: $no_of_customers = array(); $no_of_customers_ee = array(); $no_of_customers_nee = array(); $unique_customers = array(); $unique_customers_ee = array(); $unique_customers_nee = array(); $no_of_sent = array(); $no_of_sent_ee = array(); $no_of_sent_nee = array(); $no_of_opened = array(); $no_of_opened_ee = array(); $no_of_opened_nee = array(); $no_of_surveys = array(); $no_of_surveys_ee = array(); $no_of_surveys_nee = array(); $promoter = array(); $promoter_ee = array(); $promoter_nee = array(); $detractor = array(); $detractor_ee = array(); $detractor_nee = array(); $passive = array(); $pas...