Posts

Showing posts from June, 2014

php - Why can't I use GuzzleHttp in laravel controller? -

keep getting following error: object of class illuminate\routing\route not converted string $response = $client.post('url', [ 'body' => [ 'blah' => 'blah' ], 'headers' => [ // client id+client secret (base64) 'authorization' => 'basic sllalalalal=' ] ]); i'm not using route object anywhere, hardcoded strings in array. line error happens semicolon is. change $client.post $client->post . trying concat $client , post() .

android AppCompat v22.1.0 button styling -

problem: cant set style buttons correctly source devilishly simple: styles.xml: <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="colorprimary">#ff00ff</item> <item name="colorsecondary">#00ffff</item> <item name="colorcontrolnormal">#ff0000</item> <item name="android:textcolor">#0030ff</item> <item name="android:textcolorprimary">#00ff00</item> <item name="android:textcolorsecondary">#800080</item> </style> layout (applied appcompatactivity): <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="textview"/> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" /&g

vbscript - Rename files using foldername as prefix and part of current filename VBS -

Image
i have unique situation , i'd insight. have no programming background figured i'd turn here. i have bunch of folders. inside each of folders folder. inside folder few files. these files named gibberish letters , numbers, characters " - " (no quotes), , name i'd use new suffix. i take top tier foldername , make prefix , above mentioned suffix create "prefix - suffix" each new filename. my first thought via vbs, again, i'm unfamiliar. can shine light or provide script? assuming not of hassle. an example of have , i'm looking for: give try vbscript : option explicit dim file,myrootfolder,rootfolder,prefix,suffix myrootfolder = browse4folder call scan4file(myrootfolder) msgbox "script done !",vbinformation,"script done !" '************************************************************************** function gettheparent(drivespec) dim fso set fso = createobject("scripting.filesystemobject

javascript - Regex not validating end of string -

consider following scenario (javascript code): regex = new regexp((/([\d,.]+)[ $]/)); value = "2.879" the regexp doesn't match value, matches (value+" ") therefore think $ not matched? why that? shouldn't $ validate end of string? special characters $ don't have same meaning inside character class. in character class they're characters, [ $] match either space character or $ character. won't match end of string. if want match either space character or end of string, should use alternation, i.e. ( |$) .

reactive programming - Meteor: Pause reactivity on UI element -

i using meteor reactive framework allow user edit text box in web gui, update database on changes on text box, , update textbox updates database. this creates dependency loop, , when type fast, latency between updates destroys text written user. my thought of how alleviate temporarily pause updates database object user has focused on. i have tried numerous ways this. here template: <template name="valueeditor"> <div class="list-item {{editingclass}}"> <input type="text" value="{{value}}" placeholder="value"> </div> </template> here helpers: template.valueeditor.helpers({ value : function(){ var state = ! session.equals(editing_key, this._id); console.log("reactive state = " + state) var result = objects.find({_id:this._id},{reactive:state}).fetch()[0].value; console.log("database emitting '" + result + "'back ui input!!!")

Android studio 1.1.0 do not display drawable-hdpi , drawable-xhdpi, drawable-mdpi,drawable-xxhdpi -

i downloaded android studio version 1.1.0. when create project, there no drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi folders. same in other thread december 22, 2014. person had android studio 1.0 android studio 1.0 not display drawable-hdpi , drawable-xhdpi, drawable-mdpi,drawable-xxhdpi the way can folders created adding new image asset suggested joel in same thread. is new default behavior? you can create manually same name in res folder. , in android studio 1.2 beta 3 use mipmap images.

Jquery, blur event inside click event -

i'm new jquery, , i'm not able understand on how use 'blur' event inside 'click' event. my project has a toolbox: there button add elements canvas a canvas: elements added appear here a editor window: can see/edit elements properties here sketch of project: fiddle each element add canvas have 2 representations: object, , visual 1 div. the point is: when add elements canvas can click them, , can edit atributes in editor window. elements have text atribute , it's name. but if have example: 2 elements on canvas , try change text atribute of 1 of them (in editor window), changes elements text attribute. problematic function following: $(function(){ canvas.delegate('.myelement','click', function(){ var obj = this; mytextarea.val(this.text); mytextarea.on('blur',function(){ obj.text = mytextarea.val(); }); }); }); can tell me i'm failling? guys you binding blur event each tim

Erlang dynamic variable names on each iteration -

program working now. simplest solution best. registered processes did not work. having trouble call await/2 base case of start/6. turned out using modified list t_t. %variables t = 10000000, p = 4, tpart = 2500000, width = 1.0 / t, pi = pi(t, p, [], 1), calls pi/4 , gets list of pid start(t, p, tpart, width, pi, 1). %calls start pi variable should contain 4 pids % create list of p pids , return pi(_, p, list, count) when count > p -> list; pi(t, p, list, count) -> pid = spawn(pi, child, []), count2 = count + 1, pi(t,p, [pid|list], count2). %start iterates through list of pids , sends work order each process start(_, p, _, _, _, staticlist, count) when count > p -> await(staticlist, 0.0); start(t, p, tpart, width, [head|tail], staticlist, count) -> head ! {work, self(), p, count, tpart, width}, count2 = count + 1, start(t,p,tpart,width,tail, staticlist, count2). % collects partial sums child processes. pri

Ansible stops service but doesn't restart it -

we deployed ansible in our different environments , i'm running problem can't find solution to. on 2 servers have start , stop services becoming specific user. su - itvmgr then have run custom command stop , start services: itvmgrctl stop dispatcher itvmgrctl start dispatcher one of tasks looks this: - name: "start dispatcher service" sudo_user: itvmgr command: su itvmgr -c '/itvmgr/bin/itvmgrctl start dispatcher' - name: pause pause: seconds=15 there's task stop looks 1 using stop instead of start . the problem i'm running ansible stops service fine fails start service again. i'm not getting errors while it's running can't find reason why stop service fine, same command fails start it. if has suggestions on how can troubleshoot problem appreciated. perhaps start-script needs interactive shell or environment variables?

Cache Facebook Profile Picture iOS -

i'm saving images disk app users, either upload picture or connect facebook , display profile picture. this works great, if user changes facebook profile picture, code below never updates image. how can check facebook graph api check if image has been uploaded without redownloading image? using afnetworking checking 302 header option if possible-just not sure how implement. //load image if exists on disk nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsstring *documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject]; nsstring *filepath = [documentspath stringbyappendingpathcomponent:uniquecustomerpath]; bool fileexists = [filemanager fileexistsatpath:filepath]; if(fileexists){ uiimage* tempimage = [uiimage imagewithcontentsoffile:filepath]; completionhandler(tempimage); } //download image if not else{ nsstring *imageurl=[nsstring

c++ - How does one pull a specific number from an array of randomly generated numbers using an if...else statement? -

bool statsarray::isnumberfound(int somenumber) { if (data[size] == somenumber) { cout << "congrats, have perfect score!" << endl; } else { cout << "sorry, not have perfect score." << endl; } return 0; } not sure if i'm on right track, pull score of 100 using: examdata.isnumberfound(100); from array of randomly generated numbers. what reasons using if-else statement here? iterate on elements using for-loop instead. for(int = 0; < numofelements; i++) { if(data[i] == somenumber) { cout << "congrats, perfect score!" << endl; return true; } } // nothing matched.. cout << "sorry, not have perfect score." << endl; return false;

Can the new http connector be used with the http:static-resource-handler in Mule 3.6? -

i have following flow, attempting use new http connector in mule 3.6 http:static-resource-handler: <flow name="facebook-sources-apiflow1"> <http:listener config-ref="http_listener_configuration" path="/admin" doc:name="http"/> <http:static-resource-handler resourcebase="${app.home}/web" defaultfile="index.html" doc:name="http static resource handler"/> </flow> i have directory called 'web' under src/main/app, , index.html in web directory. when try this, though, following error: null (java.lang.nullpointerexception). message payload of type: nullpayload before sinking time problem, thought i'd ask if new http connector works static-resource-handler. i'm afraid can't. there bug around this: https://www.mulesoft.org/jira/browse/mule-8317

How to store a "complex" data structure in R (not "complex numbers") -

i need train, store, , use list/array/whatever of several ksvm svm models, once set of sensor readings, can call predict() on each of models in turn. want store these models , metadata tham in sort of data structure, i'm not familiar r, , getting handle on data structures has been challenge. familiarity c++, c, , c#. i envision sort of array or list contains both ksvm models metadata them. (the metadata necessary, among other things, knowing how select & organize input data presented each model when call predict() on it.) the data want store in data structure includes following each entry of data structure: the ksvm model itself a character string saying trained model & when trained an array of numbers indicating sensors' data should presented model a single number between 1 , 100 represents how i, trainer, trust model some "other stuff" so in tinkering how this, tried following.... first tried thought simple & crude, hoping build on

Using a Method from Controller in Another Rails -

i using elasticsearch on rails 4 app search through articles. however, when article not found redirects page alerts user no results found, , allows request page. instead of saying "no results found" want "no results ______ found" in takes search bar query. i have defined method in articles_controller in order query won't show on page since "no results page" uses different controller. what best way pull method onto controller or view in case? having trouble finding straight forward answer trying do. thank much. articles_controller: def index if params[:query].present? @articles = article.search(params[:query], misspellings: {edit_distance: 1}) else @articles = article.all end if @articles.blank? return redirect_to request_path end get_query end private def get_query @userquery = params[:query] end new.html.erb (view "no results found" page. uses different controller a

syndication feed - c# SyndicationItem pubdate to GMT -

i've been trying produce rss feed using system.servicemodel.syndication library.. at moment it's displaying aest +1000 (e.g. thu, 23 apr 2015 09:44:29 +1000) need produced gmt (e.g. sat, 07 dec 2013 19:39:04 gmt) is there way set or force date format publishdate property in syndicationitem? or defaulted server time setting ?

java - How to locate another object in a JFrame? -

let's suppose there object in specific jframe uses same abstract class. now i'm wondering how find location of object inside jframe it's moving automatically. i have superclass that's board. inside board, have bunch of objects share same abstract class coded differently. i want use objects locate each other without editing field class. how that? store objects in list<abstractclassname> , can iterate on them every time want perform action on of them, or search specific 1 based on it's properties if want 1 of them.

objective c - registerUserNotificationSettings only asks me once if "APPNAME would like to use push notifications". I need it to ask me again for testing. How? -

i'm testing push notifications right now. registerusernotificationsettings supposed ask user once , once if "appname send push notifications". however, i'm testing app right , need ask me again. i've deleted application device, , re-run application on device xcode cannot ask me again. what need delete device question show again? i found answer. https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/dts40010376-ch1-tntag42 resetting push notifications permissions alert on ios the first time push-enabled app registers push notifications, ios asks user if wish receive notifications app. once user has responded alert not presented again unless device restored or app has been uninstalled @ least day. if want simulate first-time run of app, can leave app uninstalled day. can achieve latter without waiting day following these steps: 1) delete app device. 2) turn device off , turn on. 3) go settings > gene

ios - How do I rename my Xcode project without losing my data? -

how rename xcode project (aka .xcodeproj) without losing data? gives me error before breaking whole project: the file container @ appname .xcodeproj/project.xcworkspace has disappeared. want re-save container or close it? i using xcode 6.3.1 what name? project name?project folder name?or app display name? “do want re-save container or close it?” i think rename project folder name. can reopen project in finder.

java - Byte Array not printing to file correctly -

i'm creating program aims take in n number of splits , split file amount of sub-files. in splitfile.java , i'm reading file, passing array of substrings show text that's supposed go in each split file. convert string byte array , write byte array split file, each file i'm creating outputting just different. splitfile.java import java.io.*; import java.nio.charset.charset; import java.util.arraylist; public class splitfile { int numberofsplits = 1; file file; string[] parts = new string[5]; public splitfile(file file,int numberofsplits) { this.file = file; this.numberofsplits = numberofsplits; } public void filesplitter() throws ioexception { fileinputstream fis = new fileinputstream(file); string filetext = readfile(); if(numberofsplits == 2) { int mid = filetext.length() / 2; parts[0] = filetext.substring(0, mid); parts[1] = filetext.subst

javascript - Using jQuery to select/deselect radio buttons with different names -

i have quiz uses ids of answers in db name in order check if they're correct. can't make them same name. anyways leaves me radio buttons can checked , isn't how should work. found jquery allows radio buttons unchecked need them uncheck when click other buttons. html: <fieldset> <input type="radio" name="21"> <label for="21">answer 21</label> <input type="radio" name="22" class="checked"> <label for="22">answer 22</label> <input type="radio" name="23" class=""> <label for="23">answer 23</label> <input type="radio" name="24"> <label for="24">answer 24</label> </fieldset> script: $("input[type='radio']").click(function (event) { // if button selected. if ($(this).hasclass("ch

xml - Display elements and respective value in XSLT -

i xslt beginner, requirement getting element , respective value in table format, tried did not expectation, kindly suggest solution requirement. my input xml is <group> <elementgroup1> <element1>value1</element1> <element2/> <element3>value3</element3> </elementgroup1> <elementgroup2> <elementsubgroup2> <element4>value4</element4> <element5>value5</element5> </elementsubgroup2> </elementgroup2> </group> my xslt is <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" exclude-result-prefixes="xs" version="2.0"> <xsl:template match="/"> <xsl:element name="table"> <xsl:attribute name="border" select="'1'"/> <xsl:element n

javascript - How to write the expression to disable an input text after entered a particular string -

now have this: <input type="text" ng-model="cell.location"> what want while put 'abc' in field, field become disabled status, know can put boolean param control via controller. however expect this: <input type="text" ng-disabled="{{cell.location = 'abc'}}" ng-model="cell.location"> which clearer , simpler, unfortunately approach doesn't work expected, assign 'abc' field rather disable it. possible implement in kind of way? thanks. use == : <input type="text" ng-disabled="cell.location == 'abc'" ng-model="cell.location" /> instead of: <input type="text" ng-disabled="{{cell.location = 'abc'}}" ng-model="cell.location"> angular doc

haskell - What does the 'f' represent in the fmap function of a functor? -

i'm looking @ following function: fmap :: (a -> b) -> f -> f b and want understand 'f' is, in ( f a or f b ). article reading describes 'box' what's actual correct name it? type variable? think i'm confusing , thinking it's function application - correct? your intuition kind of function application correct, not regular functions. instead, application of type constructors on type level. specifically, functors must have kind (type-of-type) * -> * means take 1 type argument , produce concrete type * such as, example, [int] . examples of such type constructors include io, maybe, [], either e , many others, , these specific examples have valid functor instances. fmap (+1) [1,2,3] :: [] int -- known [int] = [2,3,4] fmap (+1) (just 1) :: maybe int = 2 fmap (+1) (right 1) :: either e int = right 2 fmap (+1) (return 1) :: io int -- uses monad io instance "=" 2

java - Hibernate SQL In clause making CPU usage to 100% -

Image
in java application using sql server , hibernate3 ejb . when tried execute select query with in clause , db server cpu usage reaches 100%. when tried run same query in sql management studio , query running without cpu spikes. application server , db server 2 different machines. table has following schema, create table student_table ( student_id bigint not null identity , class_id bigint not null , student_first_name varchar(100) not null , student_last_name varchar(100) , roll_no varchar(100) not null , primary key (student_id) , constraint uk_studentunique_1 unique (class_id, roll_no) ); the table contains around 1000k records. query select student_id student_table roll_no in ('a101','a102','a103',.....'a250'); in clause contains 250 values, when tried run above query in sql management studio result retrieved within 1 seconds , without cpu spikes. when tried run same query through hibernate cpu spikes re

r - Implementing the bootstrap method for resampling the data set. Assuming that log prices follow random walk but using ARMA model -

#install.packages("quantmod") #install.packages("dataframes2xls") #install.packages("bootstrap") #install.packages("farma") library(bootstrap) library(quantmod) library(dataframes2xls) library(farma) require(ttr) getsymbols("sne",src="yahoo",from = as.date("2011-04-20"), =as.date("2015-04-22")) snelog <- diff( log( cl( sne ) ) ) snelog <- snelog[-1,] snelogt <- as.ts( tail(snelog, 1000)) snelogtimearma <- armafit( formula=~arima(0,1,0), data=snelogt ) sne.adjusted.boot.sum <- numeric(1000) for(i in 1:1000) { this.samp <- snelog [ sample(1000,1000,replace=t, prob=??? )] sne.adjusted.boot.sum[i] <- sum(this.samp) } this code. my professor requirement: implement bootstrap method resampling data set, assuming log prices follow random walk using arma model. random walk reminds of arima(0,1,0), have no idea how combine bootstrap arma model. simply put, bootstrap

android - why countdown counter with thread show wrong value? -

i don't know why count down counter shows random number @ end? mean shows 60:15, 60:07, on way min=sec=0; new thread(new runnable() { @override public void run() { while (min < 60 && flagtime) { try { thread.sleep(1); g.handler.post(new runnable() { @override public void run() { string presec=""; string premin=""; if (sec < 59) { sec += 1; } if (sec < 10) { presec = "0"; } if (min < 10) { premin = "0"; } score =premin + min + ":" + presec + sec; txt[element

java - How to access javascript variable in a jsp page -

i want access javascript code in jsp file. have included javascript file in jsp page. javascript file abc.js has following line of code: var dynamicdiv = 'your leave approved'; and jsp file aaa.jsp has <script src="abc.js"> </script> <% string st = "<script> dynamicdiv </script>"; out.println(" value = " + st); %> javascript variable on client side, jsp variables on server side, can't access javascript variables in jsp. you can store values in hidden field somthing this clinet side: <script type="text/javascript"> var element = document.getelementbyid("myinput"); element.value = "some value here"; </script> <form action="yourfile.jsp" method="post"> <input id="myinput" type="hidden" value="" /> <input type="submit" /> </form> server side(yourfile.jsp): <

javascript - Materialize: dropdown in "if" statement doesn't work -

i tried implement dropdown list visible when user signed in. dropdown list works when outside "if" statement not inside. buttons "foo" , dropdown button shown, doesn't "dropdown". header.html <!-- header --> <template name="header"> <nav> <div class="nav-wrapper"> <a class="brand-logo" href="{{pathfor 'home'}}">logo</a> <ul id="nav-mobile" class="right hide-on-med-and-down"> {{#if currentuser}} <!-- dropdown1 trigger --> <li> <a class="dropdown-button" href="#!" data-activates="dropdown1"> <i class="mdi-navigation-more-vert"></i> </a> </li> <li><a href="#">foo</a></l

Is a CSS property starting with a hash (#) valid? -

what following css , valid? h4 { width: 83%; #width: 75%; } it not valid. #width: 75%; syntax error, since # isn't used in css property names (although used in css selectors, select elements specific id s). browsers ignore (hopefully) , first rule applied. it might have been someone's attempt write css comment. valid way: /*this comment*/ edit i suggest using css reset file account browser differences.

winforms - make autocomplete textbox using tableadapter windows forms C# -

i have piece of code autocomplete search textbox autocompletestringcollection coll = new autocompletestringcollection(); datatablereader reader=this.customertableadapter.getdata().createdatareader(); while(reader.read()){ coll.add(reader.getstring(0)); } search.autocompletecustomsource = coll; is best way perform it? or there function make autocomplete source column directly? moreover code filters first name, when use piece of code gridview gives me better search abilities catches part of name private void search_keyup(object sender, keyeventargs e) { string outputinfo = ""; string[] keywords = search.text.split(' '); foreach (string word in keywords) { if (outputinfo.length == 0) { outputinfo = "(name '%" + word + "%')"; } else { outputinfo += " , (nam

python - Set `get_absolute_url` in Django auth -

i'm using django's built-in auth model. how can set get_absolute_url without substituting entire auth model custom auth model? you need substitute user model. can inherit abstractuser , defines fields already, need override method want: class myuser(abstractuser): def get_absolute_url(self): return ... and auth_user_model = 'my_app.myuser' in settings.py, , you're go.

Cassandra or Tomcat Timesout -

we using cassandra store large amount of data. fetch data in web application using tomcat have few select * , select count(*). data retrieval fails application uses java code catching timeout exception thrown cassandra. so, majorly seems cassandra issue. want know if tomcat issue also? if cassandra issue know if solution it. would know if configuration parameter can changed in cassandra yaml, fix can done. in advance.

c# - WPF ListBoxItem does not stretch to the maximum width in wrappanel -

i trying make listbox contains custom control , wrap automic.my listbox xaml code below.i need 3 items in each row , stretch maximum width.it wrap next row if items more three. need custom control stretch on in horizontal not both side. how can that? <scrollviewer horizontalscrollbarvisibility="disabled"> <listbox> <listbox.template> <controltemplate targettype="{x:type listbox}"> <wrappanel orientation="horizontal" isitemshost="true" /> </controltemplate> </listbox.template> <listboxitem> <controls:transduceritem margin="5,10"/> </listboxitem> <listboxitem> <controls:transduceritem margin="5,10"/> </listboxitem> &

php - Customer cannot login after magento upgrade from 1.7 to 1.9.1 -

i upgraded magento 1.7 1.9.1. features seems working including added extensions. when customer trying login, redirects login page error. invalid login or password. i tried adding formkey code login form no success in logging in. used both formkey codes found posted users, works lots of other users <?php echo $this->getblockhtml('formkey'); ?> and <input type="hidden" name="form_key" value="<?php echo mage::getsingleton('core/session')->getformkey(); ?>" /> is because password stored in different format in magento 1.9.1 in magento 1.7? anyone has other solutions? solution: in case, encryption method. previously, magento setup had, used have sha256 encryption rather md5. formkey should have worked guess if did not had encryption. had change app/code/local/mage/core/model/encryption.php public function hash($data) {return md5($data);} to public function hash($data) {retu

How to write php returns json format according to the key? -

i use xampp create local networks , write php file return data in database json. code: <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "landslide"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } function myexample { $mysqli = "select id, temp, acc, moisture, battery, time devices"; $result = $conn->query($mysqli); if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_array($result)){ $response["main"] =array(); $response["parameters"]= array(); $main = array(); $main["id"]=$row["id"]; array_push($response["main"],$main); $parameter = array(); $param

javascript - UI-Router States: How to make app.run with $rootScope.$on minification safe -

i'm using ui-router in app , check if order of states correct, use code this: .value('myroutesteps', [ { uisref: 'myroute.home', valid: true }, { uisref: 'myroute.pageone', valid: false }, { uisref: 'myroute.pagetwo', valid: false }, ]) .run([ '$rootscope', '$state', 'myroutesteps', function ($rootscope, $state, myroutesteps) { $rootscope.$on('$statechangestart', function (event, tostate, toparams, fromstate, fromparams) { var cangotostep = false; var tostateindex = _.findindex(myroutesteps, function (myroutestep) { return myroutestep.uisref === tostate.name; }); console.log('tostateindex', tostateindex) if (tostateindex === 0) { cangotostep = true; } else { cangotostep = myroutesteps

angularjs - Meeting problems while using jQuery plugin in the modal of Angular-strap -

Image
i try use mention.js in project, doesn't work in modal of angular-strap. here plunker myapp.controller("createmodalctrl", function($scope) { $("#members").mention({users: usersinfo}); }); in main page, mention.js works well: but when comes modal page, plugin doesn't work. besides, plnker can not show modal page, , can copy code plnker local project. thanks! myapp.controller("createmodalctrl", function($scope) { //$("#members").mention({users: usersinfo}); settimeout(function(){ $("#members").mention({users: usersinfo}); $scope.$apply();}, 0);}); and works...

awk - Replicate a string names x times and ascribe replication number -

i replicate key names x number of times , have separate column indicate replication number, e.g. let's have 3 key names follows: 101 102 103 so, each of above numbers (names) replicated 3 times , have separate identifier number equal 4 characters. therefore this: 101 0001 101 0002 101 0003 102 0001 102 0002 102 0003 103 0001 103 0002 103 0003 i guess genered relatively straight forward awk script? *edit: not specify names replicate in script - should "replicate names in text file", there lot of them (~400) , variable name types. thank in advance! in bash echo {101,102,103}" "{01,02,03} 101 01 101 02 101 03 102 01 102 02 102 03 103 01 103 02 103 03 following fedorqui's advice newlines printf "%s\n" {101,102,103}" "{01,02,03} 101 01 101 02 101 03 102 01 102 02 102 03 103 01 103 02 103 03

xaml - Binding placeholder from resource file in WPF -

in resource file have locker no. {0} open i need bind resource file text box , want dynamically set value in palce holder foreground red. below shows code <textblock x:name="title" margin="0,70,0,0" horizontalalignment="center" verticalalignment="top" fontsize="42" fontweight="semibold" foreground="#888888" > <textblock.text> <multibinding stringformat="{x:static prop:resources.lockernumberisopen}"> <binding path="prefixwithnumber"/> </multibinding> </textblock.text> </textblock> how show value inside {0} red? from code behind can title.text = string.format(properties.resources.lockernumberisopen, (this.datacontext openparcelviewmodel).prefixwithnumber); var tr = this.find((this.data

How get special method of class in java? -

i have class methods in java follows: public class class1 { private string a; private string b; public seta(string a_){ this.a = a_; } public setb(string b_){ this.b = b_; } public string geta(){ return a; } @jsonignore public string getb(){ return b; } } i want methods in class1 start string get not declared @jsonignore annotation. how do this? you can use java reflection iterate on public , private methods: class1 obj = new class1(); class c = obj.getclass(); (method method : c.getdeclaredmethods()) { if (method.getannotation(jsonignore.class) == null && method.getname().substring(0,3).equals("get")) { system.out.println(method.getname()); } }

html - how do i add permanent place holder inside input filed -

Image
i need add font-icon inside input field used method <input type="text" name="your name" placeholder="&#xe00b; name" style="font-family:flaticon" class="restrict"> as see placeholder="&#xe00b; name" &#xe00b; display font-icon problem when user types text place holder disapper need font icon placed permanent inside input field <lable> can me you can't. expect like? placeholder disappears by design . if want to prefix icon in front of input field , put them in container, give container needed style , put there icon , input -tag. that's way, how bootstrap problem solves . shortened example: <div class="input-group"> <div class="input-group-addon">$</div> <input type="text" class="form-control" id="exampleinputamount" placeholder="amount"> </div> of course, need css.

How to reorder row in SELECT query in MYSQL? -

a categories table contains id , category_name , category_type etc. i getting records select query. suppose have category name shared article , want first position in records. of course using simple query select `category_name`,`category_type`,`categories`.`id`, count(`user_bookmarks`.`id`) counter `categories` left join `user_bookmarks` on `categories`.`id`=`user_bookmarks`.`category_id` `categories`.`user_id`=39 group `categories`.`category_name` but don't know how achieve task? is possible mysql ? yes can as order `categories`.`category_name` = 'shared article' desc

background process - How can I implement double processes protection in android apps? -

i found android app contains 2 processes in background though quit app. after app manager.however found hard kill them when try kill processes. kill first one, second recreate it; kill second one, first recreate other one. manage kill them after restart device. found app start processes soon. wanna know how can restart , hard kill. search whole internet, can not find related solution. in advance. wanna how work not develop these annoying apps. these processes processes services . if return start_sticky in onstartcommand , killed while in started state, later system try recreate it. so, when kill first process, it's not second process recreates rather system itself. i wanna how work not develop these annoying apps. if want services stop when killed, return start_not_sticky in onstartcommand .

How to combine or connect ArcGIS to eCogntion (Trimble)? -

i'm using ecognition object-based image analysis, , arcgis spatial analysis, , want combine them single application you can consider building plugin arcgis in python or javascript , accessing api of ecognition server. arcgis has api might hard integrate.

java - How to handle multiple bindings for SLF4j -

in project, use slf4j , logback backend logging framework.but there lot of dependencies use log4j logging framework.so turns out there multiple bindings of slf4j.how can handle that? if exclude unwanted slf4j-log4j dependencies,will framework or library handle logging correctly? you can safely exclude other bindings. slf4j bind other libraries logback.

node.js - Nodejs mocha/should on silent mode -

i try find option on mocha avoid having huge error explanation when 1 of should assertion fail. 5 passing (561ms) 1 failing 1) actors actors list should list of formed actors: uncaught assertionerror: expected ... have property properties @ test/actors.js:70:47 @ array.foreach (native) @ test.<anonymous> (test/actors.js:65:35) @ test.emit (events.js:95:17) @ incomingmessage.emit (events.js:117:20) @ _stream_readable.js:943:16 i'd have passing , failing infos not rest. idea ? cheers,

javascript - Chrome Extension Inline install procedure -

Image
<link rel="chrome-webstore-item" href="chrome.google.com/webstore/detail/itemid"> i have added above code on html page (my website hit user) associated chrome extension published in chrome store , javascript function chrome.webstore.install() . will make user install chrome extension in computer? the documentation: https://developer.chrome.com/webstore/inline_installation first off, work, need verify website own via webmaster tools. verified site requirement for security reasons, inline installations can initiated page on site verified (via webmaster tools ) being associated item in chrome web store. note if verify ownership domain (for example, http://example.com ) can initiate inline installation subdomain or page (for example, http://app.example.com or http://example.com/page.html ). once verified site, need edit extension listing via developer console select extension associated (verified) site: if have done that, a

c# - .NET application memory usage Visual Studio 2005 -

i've got c# application running on windows ce smart device , added new graphing option results in "outofmemory" exception after running few hours. how find going wrong? code looks fine, based on 1 of previous graphing options runs weeks without problem. i've tried debug > windows > memory options in vs 2005, give message "unavailable when debuggee running." i've tried attaching process using remote debugging tools (specifically windows ce remote process viewer), there's not enough functionality see i'm looking for. are there tools in vs 2005 analyse either remote c# app or 1 running locally (ie. win32)? a) see memory profiler .net compact framework b) see cf remote performance , ... viewer: http://www.microsoft.com/en-us/download/details.aspx?id=13442&751be11f-ede8-5a0c-058c-2ee190a24fa6=true looks have memory leak in code.

Using Mercurial locally with TFS Team Foundation Version Control Server Workspace -

at work using tfs team foundation version control (tfvc) , workspace server workspace (very large codebase). limitations of our setup files checked out locked edit other people. there culture of not committing until work complete etc many change-sets complicate merging later. i in no position change global rules or culture. locally setup mercurial (hg) repo on local machine. idea can work on local copy make many checkins hg. when done bundle changes 1 changeset , send off tfs location (also on local machine). checkin changes tfs server. way outside world appear checkout , checkin of code, briefly locking files changed. locally in hg full ability make small checkins , work without worrying locking files out edit. somehow chain 2 version control systems, giving me flexibility of hg locally, continue using global tfvc final checkins. any ideas on how achieved? you can use git-tf , hg-git. intentional design decision when built git-tf supported scenario. that said...

java - SBT Set javac max heap -

i'm trying compile large java source files in scala/sbt project. how can set max heap size java compiler (javac). setting javacoptions in compile ++= seq("-target", "1.7", "-source", "1.7", "-xmx1g") fails invalid argument exception on -xmx1g ... setting -j-xmx2g give similar errors. is there way can fork javac ? using sbt v 0.13.8 as you've noticed seems bug introduced in sbt 0.13.8 , see #1968 . the workaround downgrade 0.13.7 doesn't happen.

Android usb host permission confirmation dialog is being dismissed when I click outside of it -

i getting android usb host permission confirmation dialog when establishing usb connection android application. pendingintent mpermissionintent = pendingintent.getbroadcast( context.getapplicationcontext(), 0, new intent( action_usb_permission), 0); intentfilter filter = new intentfilter(action_usb_permission); context.getapplicationcontext().registerreceiver(musbreceiver, filter); manager.requestpermission(driver.getdevice(), mpermissionintent); i want implement when user clicks outside dialog, dialog not dismissed. have this? how set setcanceledontouchoutside(false); usb host permission confirmation dialog?

objective c - Initial video stream play slow (MPMoviePlayerViewController) in ios app -

in our ios app users can upload , play videos. we using aws s3 bucket store videos. aws cloudfront cdn. all videos accessing through cdn url. example : https://dnxrwxxxxxx.cloudfront.net/1417696382abc.mp4 . as checked there no issue cdn , internet connection. when play video in html player in browser there no issue. but problem when click 1 video taking long time play. can see loading.after start play video playing smoothly. issue initial loading. here code mpmoviesourcetype sourcetype; nsurl *currenturl = [[videodiskcache getsharedinstance] searchcash:urll]; if (!currenturl) { currenturl = urll; sourcetype = mpmoviesourcetypestreaming; } else { sourcetype = mpmoviesourcetypefile; } movieplayercontroller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:currenturl]; movieplayercontroller.view.superview.backgroundcolor = [uicolor blackcolor]; movieplayercontroller.view.superview.superview.back

c - Can socket send fail cause a daemon program crash? -

i have 2 applications running on embedded linux board. 1 runs daemon , other acts interface it. communicate each other using unix sockets. handle abnormal termination of socket, tried terminating interface application [ctr+c]. result, daemon application crashes. since socket terminated, socket send failed error on daemon side, expected after daemon crashes. @ loss should debugging problem. have set socket in daemon non-blocking mode ? suppose code looks following: while(1) { connfd = accept(listenfd, (struct sockaddr*)null, null); /* use fd */ func(connfd); } based on man page: " on success, accept() return nonnegative integer descriptor accepted socket. on error, -1 returned, , errno set appropriately. and if no pending connections present on queue, , socket not marked nonblocking, accept() blocks caller until connection present. if socket marked nonblocking , no pending connections present on queue, accept() fails error eagain or ewouldblock.

javascript - facing issues in executing cronjob -

sorry change in question. i have hostgator hosting. in cpanel have created cronjob not running. command: php /home/username/public_html/dir1/dir2/cron.php. in email getting whole code written in file. <html> <head> <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> <script type="text/javascript> var = 0; function getdata(){ var dt = new date(); var user1="h"; var pass= "h"; var location1='2'; var passdata = ''; if(i==0){ month = '' + (dt.getmonth() + 1), day = '' + (dt.getdate() + 1), year = dt.getfullyear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; var date1 = year+"-"+month+"-"+day; passdata = "username="+use

javascript - Delegated event handler is working more than once for same class -

i having problem delegated event used click function, have 4 images different id same class 'edit_agent_val', when click on image function runs 4 times instead of once. here code have used: sure take @ images working with: <img id="treegrid-1" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="pessimist"> <img id="treegrid-2" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="naugahyde"> <img id="treegrid-3" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="lemma"> <img id="treegrid-4" class="edit_agent_val" src="/palodrive/img/addb.svg" data-user="player" data-name="rackoz"> and here function runs 4 times instead of once: jquery(document).ready(funct

Tables or images too wide in Pandoc output as DOCX or PDF/LaTeX -

i writing quick , dirty report using pandoc , markdown. i need generate pdf or docx minimum hassle, don't care (best both, of course). also, constrained regarding figures , tables -- have been generated priori program , rather able insert them convert them suit pandoc's needs. however, main constraint don't want edit resulting document manually, latex or docx. want editing in markdown. here problem: in docx, tables displayed fine: have width of document. however, figures wide. can either convert images lower resolution (which doesn't nice), or manually resize images in word (which out of question). in pdf, generated figures fine (more or less), 2 problems appear: the tables wide, because there no line breaks, and latex being latex, order of figures , tables "reorganized", is, not consecutive. thus, none of documents generated usable purposes. all wanted slap results , generate file can send scientist. question: best solution generate