Posts

Showing posts from 2010

Select value of navbar via code (jquery) -

i have navbar on top of page people can select city. everytime close app, have reselect city, because can't find way automatically select (visually) correct city when booting app. how can this? <div data-role="navbar"> <ul> <li id="navbrugge"><a href="#" data-transition="none" data-icon="home"> brugge </a> </li> <li id="navgent"><a href="#" data-transition="none" data-icon="home"> gent </a></li> <li id="navkortrijk"><a href="#" data-transition="none" data-icon="home"> kortrijk </a></li> </ul> </div>

tfs - How do you add items (not folders) to "My Favorites" in the Team Explorer window of Visual Studio 2010? -

more specifically, have query pulls work items multiple team projects. since not associated 1 team project, placing in favorites makes more organizational sense placing in queries folder. in team explorer, can right click query choose add favorites. in web access, can add specific work items favorites (this not available in vs team explorer)

HIghcharts with chart and data at the same time -

i new highcharts , trying show chart , data @ same time. like whole display should this. first column : station name(data) second column : horizontal bar third column : data. is possible paint using highcharts api's ? thanks sukanta you talking regular bar chart categorical axis , data labels: http://jsfiddle.net/jvnjs/288/ categories:['group a','group b','group c','group d','group e'] i don't think there default setting align data labels right in column requested, sure there workaround allow done.

winforms - C# Windows Application (not wpf) mask credit card number in text box as being entered followed by validation and processing of credit card number -

i supporting c# windows applications accepts , processes credit card. due new rules, need mask credit card number it's being entered. if first number 4, visible until next number entered (e.g. 9), text box shows *9. i thought of using maskedtextbox characters "*" need show last character typed . are there best practices doing this? keep in mind need numbers , run validations before credit card processed , process credit card , store in database. have cc field in database encrypted. any suggestions/help highly appreciated. simple way have 2 text boxes. 1 user enters number into, shows masked version of input. put masked control on entry control. use textchanged or keyup events track changes , update. eg if (textboxentry.text.length <= 1) { textboxmasked.text = textboxentry.text; } else { string lastchar = textboxentry.text.substring(textboxentry.text.length-1, 1); textboxmasked.text = lastchar.padleft(textboxentry.text.length, '

Facebook Feed Dialog through WebView in Unity is Blank -

i have been using webview dropped unity(found here: https://github.com/gree/unity-webview ) implementing facebook connection. webview has been working authorization of user in oauth dialog, when try access feed dialog posting friend, end blank white screen. same generated url when dropped browser works fine. the feed dialog url generate looks this: http://m.facebook.com/dialog/feed?access_token= {access token}&app_id={app id}&from={authroized user}&to={selected friend id}&link={post link}&name={post name}& description={post description}&redirect_uri={my redirect page.aspx} example of functioning auth dialog url generate looks this: http://m.facebook.com/dialog/oauth?client_id= {app id}&redirect_uri={my auth redirect.aspx}&scope=publish_stream,publish_actions&response_type=token wondering if knows causing this particular webview. thanks in advance assistance. was tearing hair out got bottom of it. had tried escaping url , did

javascript - jquery validation form logic -

i have logic question getting stuck with. need form allow either 1 or other. either text input or checkbox, not both! }else if(question_pos==7){ if(!($('#test_check').prop('checked')) && $("#test").val()!="0" && ($("#test").val() =="" || !number($("#test").val()) || number($("#test").val())<0 || number($("#test").val())>20 )){ alert("placeholder?"); return false; the inputs: <table class="screening" width="100%" cellspacing="5px"> <tr> <td width="8%" align="right"><input name="test" id="test" type="text" pattern="\d*" size="3" maxlength="2" value="<%=session.getattribute("test")==null?"":session.getattribute("test")%>"/>

android - Custom view loses background resource when not in view -

so, i'm adding ad either admob or mmads, or have mmads interstitial ad come up, , on exit, or touch 1 of list items, starting new activity, @ end of activity, happens: http://i.imgur.com/zq7vvkq.png the top item doesn't have background resource being drawn, bottom similar this. happens ones in middle (with ads, go away). i wondering why happens , how prevent it... find on other questions 1 on using following code on listview: android:cachecolorhint="#00000000" or android:scrollingcache="false" the background resource being drawin in custom listadapter's getview(int, view, viewgroup) method. any appreciated, justin w. to verify problem try run hierarchyviewer , analize views tree , try find potential solution. have used hierarchy viewer?

javascript - Trying to create a hyperlinked "hashtag" when inputting text in a text box -

i'm creating website users posting text. 1 of text boxes on "posting" page tags/hashtags. user type in text box "#food" or "food", hit space bar, each of words typed hyperlinked.... after posted, displayed on post hyperlinked tag other users click on. ie. "tags" box here on stackoverflow i'm posting question. does know how make text box capable this? don't use inline objects that. instead use editable div; <div id="myinputbox" contenteditable="true"></div> you can make input-box of block-type, i'm not sure if browsers abide rules of inserting complex markup inside tag then.

objective c - SDWebImage not showing randomly in UITableViewCell -

hello have script downloads image , dynamically sets uitableview height after finishes download, images randomly not show , curious think when change , forth tab images appear . in options argument passing sdwebimageretryfailed. any idea more welcome , thanks. @interface neobuggyfrontpageviewcontroller() { uiimageview *adbanner; nsarray *news ; nsmutabledata *imagedata; nsurlconnection *connection; uiimage *neoimage; nsstring *category; rssitem *item; frontpageviewnewscell *cell ; cgrect newframe; __block cgrect descframe; float newwidth , newheight; __block float blockheight; } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { item = [news objectatindex:[indexpath row]]; cell = [tableview dequeuereusablecellwithidentifier:@"frontpagenewscell"]; [[cell newstitle] settext:[item title]]; [

javascript - AngularJS: multiple directives with transclusion on same element -

i'm trying inject 2 templates element , operate on them: <div ic-first="foo" ic-second="bar" ic-third="baz" ic-fourth="qux" > </div> icfirst should inject via template empty div child of element. icsecond should inject second div (with bunch of content) second child of element, resulting html like: <div ic-first="foo" // priority: 100 ic-second="bar" // priority: 50 ic-third="baz" // priority: 0 ic-fourth="qux" // priority: 0 > <div id="foo"></div> <div> <!-- bunch of stuff templateurl --> </div> </div> both icfirst , icsecond inject other elements newly created containers. when specify directive template property on both directives, error: error: multiple directives [icfirst, icsecond] asking template on: <div ic-first … when add transclude: true both directives, icfirst executes fine…bu

ruby - Is there a way to stop rails logging everything? -

i don't want log incoming ips, don't want log internal happenings. want rails process requests come in , that's that. is possible do? how can prevent having growing development.log or production.log? you replace rails logging facilities loggers log /dev/null: class nullloggerrailtie < rails::railtie initializer 'null_logger', :before => 'initialize_logger' |app| rails.logger = activerecord::base.logger = actioncontroller::base.logger = ::logger.new("/dev/null") end end this reroute of rails logging null device, rather letting go file anywhere. logging still happen, it'll trashed.

sitecore - Missing Webforms for Marketers Data -

i'm attempting troubleshoot sitecore system has webforms marketers module installed. i have submitted contact form front-end when @ form reports, there legacy data on "data" tab. if in "usability report" tab, can indeed see submitted data. there several save actions set up, 1 of save database, , send mail. neither seem firing. since data under usability report, seem working i'm not sure how troubleshoot issue originates from. one key piece of info site has been moved 1 server another. connection strings work far can tell, however. also, there no cd/cm separation, master => web publishing setup, though seems @ 1 time before got hands on it, there staging server. said though, connection strings seem in order. any ideas? turns out think did have previous staging server. removed following connectionstrings.config <add name="remotewfmservice" connectionstring="url=http://{mysite}/sitecore%20modules/shell/web%20forms%2

c++ - Cannot figure out how to do this code -

i have been working on project simulates bank account. user can deposit, withdraw, , have withdraws , deposits displayed on screen. @ top of selection menu needs current balance. so, savings : 100. , whenever deposit money or withdraw money need balance change correct amount. amount starts @ $100. if deposit or withdraw money work first time, on second time gets reset $100 , transaction done. how can make balance stay correct amount without resetting? school project , not looking provide me code. seeking tips or guidance in right direction. here code int main() : int main () { saving sa; creditcard cca; checking ca; string n; int option; int exit = 1; int x = 1; do{ cout << endl; cout << "checking balance:" << ca.getbalance() << " " << "savings balance:" << sa.getbalance() << " " << "credit card balance:" << cca.getbalance()

mysql - SQL Integer Range When Creating Tables -

i'm trying give int in 1 of create statements range of possible values, i.e. create table site( **siteid int (1,4),** userid int unsigned not null, name varchar(128) unique not null, foreign key (userid) references users(userid), primary key (siteid) ); i forget syntax use ranges, , i'm pretty sure i'm erring when i'm attempting use is. in advance. author's note : first 2 parts of answer incorrect. thought mysql supported check constraints , didn't. still doesn't. limit columns simple list of values, use enum approach @ end of answer. if logic more complicated (range of values, value based on column, etc.), mysql option trigger. you need check constraint if it's int : create table site ( siteid int, constraint siteid_ck check (siteid in (1, 2, 3, 4)), ... , rest or: create table site ( siteid int, constraint siteid_ck check (siteid between 1 , 4), ... , rest or if can live string siteid the

Rails seed JSON ignore some attributes -

i using rails json gem seed database json data. in seeds.rb file, have method businesspath = "#{rails.root}/public/business2.json" businesses = json.parse(file.read(businesspath)) businesses.each |business| business.create!(business) end however, json data given few attributes not want model business have. when try seed is, error. can't mass-assign protected attributes: schools, categories, neighborhoods, longitude, latitude, type those attributes don't have in business model in rails attributes each business in json file. there way ignore attributes before running business.create? thanks! try hash#slice or hash#except activesupport provides. can run: businesspath = "#{rails.root}/public/business2.json" businesses = json.parse(file.read(businesspath)) and can blacklist attributes businesses.each |business| business.create!(business.except(:schools, :categories, :neighborhoods, :longitude, :latitude, :type)) end

java - What is the best way to make my buttons on my calculator interactive, so that they can actually add, subtract, etc? -

i wanted make small calculator project fun test out new gui knowledge java swing api. created gui, there's crucial part missing: math! question is, how add functionality each of these buttons? in simpler terms: how make buttons add text box(2+2) when user clicks buttons, , have system add numbers , display them user? import java.awt.borderlayout; import java.awt.color; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import javax.swing.boxlayout; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextfield; import javax.swing.uimanager; public class basiccalculatordesign { public static void main(string[] args) { try { uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); } catch (exception e) { } basiccalculatordesign calc = new basiccalculatordesign(); calc.start(); } public v

c++ - temporary pointer point to a using vector address -

i have question parsing string s binary tree. struct treenode { string val; // data in node. treenode *left; // pointer left subtree. treenode *right; // pointer right subtree. }; string s="((or (and pass (not reject)) (and (not pass) reject)))"; i stroke , eliminate "(" , ")" , keep separate part in vector aftersplit, aftersplit has (bottom) or , pass not reject , not pass reject (back) vector<string> aftersplit; vector<treenode> parsetree; while (!aftersplit.empty())//do parsing { treenode *temp=new treenode; temp->val=aftersplit.back(); temp->left=null; temp->right=null; aftersplit.pop_back(); if(temp->val=="and"||temp->val=="or"||temp->val=="=>"||temp->val=="<=>"){ treenode *leftnode = new treenode; leftnode=&parsetree.back(); parsetree.pop_back(); temp->left=leftnode;

Webrick Rails Server doesn't run correctly -

i have spent last 6 hours fixing issues modifying $path, installing gems should be. after create project folder it's components , trying run server, got message :- \kamal$ ls gemfile readme.rdoc app config.ru doc log script tmp gemfile.lock rakefile config db lib public test vendor \kamal$ rails server => booting webrick => rails 3.2.13 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server exiting /library/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': access denied user 'root'@'localhost' (using password: no) (mysql2::error) /library/ruby/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize' /library/ruby/gems/1.8/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new' "and many many lines same above" the gem list * local gems * actionm

sass - how to compile scss files in my part folder? -

i want compile scss css in part folder . how ? compass watch command can compile root sass folder css folder. example: want compile top_menu.scss top_menu.css. config.rb sass css part top_menu |--top_menu.php |--sass | |--top_menu.scss |--css | |--top_menu.css try executing compass watch command follows compass watch --sass-dir part/top_menu/sass --css-dir part/top_menu/css -c config.rb i hope helps. cheers!

C++ template class's template specialization -

i trying specialize template method 'he' couldn't compile. how right? #pragma once template<typename a, typename b> class template_test { public: template_test(); ~template_test(); template<typename c> void he(c gg); }; template<typename a, typename b> template<typename c> void template_test<a, b>::he( c gg ) { } template<typename a, typename b> template<> void template_test<a, b>::he( int gg ) { } error c1506: unrecoverable block scoping error unable match function definition existing declaration you have specialize class also. cannot specialize member: template<> template<> void template_test<int, int>::he<int>( int gg ) { } howev

javascript function to add to pulldown menu -

okay, have pulldown menu looks this: <form action="" method="post" name="myform"> <select name="test_select"> <option value="1">my val 1</option> <option value="3">my val 3</option> <option value="4">my val 4</option> </select> <input type="submit" value="test_button" name="test_button"> </form> just basic menu. how can search through , add value 2 menu function? want end looking this: <form action="" method="post" name="myform"> <select name="test_select"> <option value="1">my val 1</option> <option value="2">my val 2</option> <option value="

javascript - Is there a way to open TinyMCE popup dialog from a button? -

i'd have tinymce open popup dialog , load specified content editing. i have text inside div , upon clicking button, i'd have tinymce open editing text. i believe you'd need fancybox modal popup window. rest rather simple: script (in page1.htm) <script> $(document).ready(function() { $(".element").fancybox({ fittoview : false, width : '500px', height : '500px', autosize : false, closeclick : false, openeffect : 'none', closeeffect : 'none', }); }); </script> then you'd need whole load tinymce code , textarea code (as in tinymce demos on site , in dowloads) loaded in external page (page2.htm), , you'd need call page2.htm iframe in fancybox, not sure if proper way it, works in chrome , firefox: <a class="element" data-fancybox-type="iframe" href="page2.htm"><input type=&quo

urlhelper - In Rails, what's the URL helper for an unknown model? -

i'm trying path in rails model don't know class of in rake task (so it's not in .erb). i know can this: rails.application.routes.url_helpers.<model>_path(model) but if don't know model? seems not rails-y switch on model.class or other such inspection. i'm looking default path or url model. edit: clarify mean default path, it's href when link_to; i.e., can this: <%= link_to "my model", @model %> without specifying url helper model_path. that's i'm looking for. internally, link_to calls url_for path given arguments. if call url_for model, it'll forward further polymorphic_path or polymorphic_url . so should work, if want path task :some_task => :environment include rails.application.routes.url_helpers # ... path = polymorphic_path(some_model_instance) # => e.g. "/widgets/42" end you can use url_for , you'll have define :host option. see here more

c# - Classes calling a common method - delegate? -

i have form creates backgroundworker. worker work, , reportprogress send messages ui while it's busy. log messages ui. reportprogress done single method in thread, called 'notify'. however, within thread, call static class file access type work. static class needs report progress... need call notify method of thread class called static class - but, have no access methods within calling class. so, ui creates thread... , thread uses class, need call notify method in class, static class. how can this? this attempt far. idea try use delegate... but, stuck @ using delegate. :) in thread class, have method: public void notify(string message, constants.errorlevel errorlevel) { var su = new statusupdate {statusmessage = message, errorlevel = 0}; _bw.reportprogress(0, su); } this working. reports calling ui. i created delegate in class: public delegate bool notificationsdelegate(object messageholder); i have changed static class handing file management,

c# - System.Threading.Timer is not firing -

in dll have 1 class uses system.threading.timer in order execute particular method @ regular intervals. using dll in winform application, timer not firing. it executing once eventhough maintaining reference timer. any idea on why timer not working? you either need set autoreset property true, or call start() again each time elapses.

ruby on rails - have_selector testing page title does not work -

i have following codes testing require 'spec_helper' describe pagescontroller render_views describe "get 'home'" "returns http success" 'home' response.should be_success end "should have right title" 'home' response.should have_selector("title", :content => "ruby on rails tutorial sample app | home") end end but when run rspec spec/ have error validating page title. have modified home.html.erb this <!doctype html> <html> <head> <title>ruby on rails tutorial sample app | home</title> </head> <body> <h1>sample app home page</h1> <p>find me in app/views/pages/home.html.erb</p> </body> </html> i have rspec version 2.13.0 capybara version 2.1.0 try: response.should have_content "ruby on rails tutorial sample app | home"

vb.net - Submit button on web browser with html element -

okay, website http://dogwars.com/app/ i'm making app can login , stuff. but login button on website: <div style="margin-left: 77px; margin-top: 20px; height: 40px;"> <a href="#" onclick="document.getelementbyid('loginform').submit();" class="button"><span>login</span></a> </div> for automatic submit button on vb.net use this: if curelement.getattribute("onclick").equals("document.getelementbyid('loginform').submit();") curelement.invokemember("click") end if but not log in automatically , i'm puzzled why doesn't..? could me out? here full code: public class form1 private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click webbrowser1.navigate("http://dogwars.com/app/") end sub private sub webbrowser1_documentcompleted(byval sender system.object, byval e

install - Set installation prefix automatically to custom path if not explicitly specified on the command line -

for internal tests, install prefix default subdirectory of build directory, unless explicitly overridden user. know user can specify install prefix by: $ cmake -dcmake_install_prefix=/foo/bar .. but if user not specify this, should default to, e.g. ${pwd}/installed . the variable cmake_install_prefix set /usr/local , cannot check see if unset/empty before setting it. my current solution add custom switch user has invoke specify cmake_install_prefix variable gets respected: option(enable_install_prefix "install build targets system (path given '-dcmake_install_prefix' or '${cmake_install_prefix}' if not specified)." off) if ( enable_install_prefix ) set (cmake_install_prefix installed cache path "installation root") else() set (cmake_install_prefix installed cache path "installation root" force) endif() my questions are: (a) there issues above, beyond annoyance of flag needing passed cmake cmake_install_prefix h

Array of image button and textview in android -

i trying create array in each item have image button , below image button text view in center . can tell me how this. tried below code not getting worked but=new imagebutton(this); but.setfocusableintouchmode(true); but.setid(1); imbrelp= new relativelayout.layoutparams(layoutparams.wrap_content,layoutparams.wrap_content); rel.addview(but,imbrelp); tv= new textview(this); tvrelp= new relativelayout.layoutparams(layoutparams.wrap_content,layoutparams.wrap_content); tvrelp.addrule(relativelayout.below, but.getid()); tvrelp.addrule(relativelayout.center_horizontal, but.getid()); rel.addview(tv, tvrelp); setcontentview(rel); i avoid trying create relativelayout in code. it's going messy want do. instead, create xml layout file individual item, , inflate each item in array. container layout in res/layout/main.xml: <linearlayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="wrap_content"

titanium - Bundle package is not working in TideSDK -

i have developed simple desktop application using tidesdk(1.3.1-beta) , tidesdk developer(1.4.2) windows platform.i packed application bundle package.its running in machine.but shows following error message when execute in other machines. error message during execution on machine this application has failed start because application configuration incorrect.reinstalling application may fix problem same issue appeared today. try installing vc redist 2010 + vc redist 2012. helped in case

pip - Pyside install fails (Python 2.7.4) -

i upgraded ubuntu 13.04 (beta) , i'm getting error when trying install pyside virtualenv (python 2.7.4) using pip: error: failed locate python library /usr/lib/libpython2.7.so.1 anyone have ideas? i've tried previous versions dev version, still no luck. edit: console log post_install (monster)tony@tonyubuntu:~/downloads/pyside-setup$ python pyside_postinstall.py -install pyside package found in /home/tony/downloads/pyside-setup/pyside... patched rpath in /home/tony/downloads/pyside-setup/pyside/qtuitools.so /home/tony/downloads/pyside-setup/pyside. patched rpath in /home/tony/downloads/pyside-setup/pyside/qtcore.so /home/tony/downloads/pyside-setup/pyside. patched rpath in /home/tony/downloads/pyside-setup/pyside/qttest.so /home/tony/downloads/pyside-setup/pyside. patched rpath in /home/tony/downloads/pyside-setup/pyside/qthelp.so /home/tony/downloads/pyside-setup/pyside. patched rpath in /home/tony/downloads/pyside-setup/pyside/qtxml.so /home/tony/downloads/pyside

css float - Lightbox alignment issue -

on button click m opening lightbox. displaying content on it. lightbox working fine. in high resolution alignment of lightbox center screen. if see same in normal resolution 1024 *768. lightbox showing in left of screen. want show in center of screen resolutions. using following css. .white_content_note { display: none; position: absolute; width: auto; height: auto; padding: 15px 25px; opacity:1.00; border: 2px solid #c90000; background-color: #ffffff; z-index:1002; border-radius: 10px 10px 10px 10px; top:165px; margin:0; font-family:calibri; right:455px; behavior:url(images/pie.htc); } even try position : relative; margin: 50px auto; it not working. appreciated you should use relative setting right alignment: right:455px; and change position relative also.

java - Sorting a string of numbers with negative integers -

i have searched lot 2 days , not successful , now have strings 7 integer numbers ( both + , - ) separated comma . i have written sample code explain . arraylist<string> str = new arraylist<string>(); str.add("9,-9,21,23,28,29,35"); str.add("18,18,-21,28,28,32,34"); str.add("-11,-11,22,28,29,-30,31"); str.add("8,-8,26,31,31,31,31"); str.add("8,8,26,-32,25,29,35"); str.add("10,9,-21,45,25,29,35"); str.add("-11,59,21,25,25,-29,35"); str.add("12,-9,21,55,25,29,15"); str.add("9,9,21,25,25,-29,35"); str.add("7,9,21,25,-35,25,35"); str.add("4,-39,21,-15,25,-29,35"); str.add("9,9,21,25,27,29,-35"); str.add("10,9,21,35,25,39,15"); str.add("8,-9,21,-25,25,29,-35"); str.add("18,-9,21,-23,25,29,-35");

ios - Navigate Back to previous view controller -

i have uiview->uicollectionview->uicollectionviewcell . trying navigate programatically none of these works. code did called. using storyboard. - (void) goback:(nsnotification *) notification { // [self.navigationcontroller popviewcontrolleranimated:yes]; // [self dismissviewcontrolleranimated:yes completion:nil]; [self.navigationcontroller poptorootviewcontrolleranimated:yes]; } you need use: [self.navigationcontroller poptorootviewcontrolleranimated:yes]; this bring root view controller. if want navigate previous view controller, should implement: [self.navigationcontroller popviewcontrolleranimated:yes];

C# WindowsForm - How Detect if focus enter in textbox was by mouse click or tab -

i have code select text in textbox if have wrote inside (textlength > 0), work perfect when focus enter using tab on textbox, select or not, little problem when focus in made mouse click, execute code bellow if focus enter isnt mouse click, because if mouse click on textbox , have text, select 0,1 seconds , unselect (but user can view blue select text after unselect) , isnt good my code: private void txtvalormetrocubico_enter(object sender, eventargs e) { if (txtvalormetrocubico.textlength > 0) { txtvalormetrocubico.selectall(); } } what (incorrect syntax, understand goal) private void txtvalormetrocubico_enter(object sender, eventargs e) { if (isnt mouse_click) { if (txtvalormetrocubico.textlength > 0) { txtvalormetrocubico.selectall(); } } } thanks in form's constructor can hook gotfocus event public form1() { textbox1.gotfocus += tex

javascript - How to get the total depth of an unknown JSON hierarchy? -

i've been struggling find/build recursive function parse json file , total depth of children. the file looks this: var input = { "name": "positive", "children": [{ "name": "product service", "children": [{ "name": "price", "children": [{ "name": "cost", "size": 8 }] }, { "name": "quality", "children": [{ "name": "messaging", "size": 4 }] }] }, { "name": "customer service", "children": [{ "name": "personnel", "children": [{ "name": "ceo", "size": 7 }]

PHP: Select part of string (from to) and apply changes on it -

i want way change part of string according simple marks. example: $string = "i'm student (at jic college), , i'm genius."; i want select at jic college or words between brackets , change color. (i know how change color). how select change put back. , how if had more 1 brackets. $string = "i'm student (at jic college), , i'm genius (not really)."; you use preg_replace achieve this. $string = "i'm student (at jic college), , i'm genius (not really)."; $string = preg_replace('/\(([^\)]+)\)/', '<span style="color:#f00;">$1</span>', $string); unfortunately example little unclear chosen encapsulation gets lost in regex , needs escaping. i'd use other brackets if you're making code clear!

ssl - How to change a .p12 file to .key file -

i have .p12 file, can transfer .pem file, how transfer .key file? openssl pkcs12 -in out.p12 -nodes -out private.key -nocerts openssl ask password, store unencrypted private key file private.key documentation: https://www.openssl.org/docs/man1.1.0/apps/pkcs12.html

asp.net mvc 4 - Validation for numeric but not equal to 0 in MVC4 -

i want use dataannotations in mvc4 valid value numeric greater 0, please help. thanks. you use [range] attribute: [range(1, int.maxvalue, errormessage = "the value must greater 0")] public int value { get; set; }

ios - UISearchBar Appearance still shows 1px border when pulled down -

Image
this screenshot while pulling down on table (which pulls search bar away tabs top). my searchbar customized via appearances api. that 1px border top remains though i've set background image. varies color depending on 'style' of search bar (in instance have search bar set black opaque). any idea how rid of it? i've tried setting clear background color, , trying change border color on layer of search bar. i haven't found clean way, looping through subviews found image view used create line. it's frame (0, -1, 320, 1). to remove it, test equality , remove: for (uiview *view in self.searchdisplaycontroller.searchbar.subviews) { if (cgpointequaltopoint(cgpointmake(0, -1), view.frame.origin) && cgsizeequaltosize(view.frame.size, cgsizemake(self.view.frame.size.width, 1))) { [view removefromsuperview]; self.searchbarlineremoved = yes; } }

linux - Bash Script Cron Job -

i have installed pcoip teradici pcoip solutions linux in centos 6.4. want macadress of hostcard, when run pcoip_agent -info gives correct output using command line. want make cron job, purpose write bash script #!/bin/bash hostcardmacaddress=$(pcoip_agent --info|grep -f 'pcoip host card mac:'|awk '{print $5}' > hostcardmacaddress.txt) cat hostcardmacaddress.txt after make script cron job gives empty macaddress. kindly me. thanks. check mail of user owns cron job. there error message indicating issue is. login cron-job's user enter mail , check mail @ time cron job invoked.

bash - Expand a variable inside `` command -

i not find exact reference i'm doing... i have following script not expand variable inside command: #!/bin/bash name="my name" `convert -pointsize 250 -font /usr/share/fonts/truetype/msttcorefonts/impact.ttf -fill black -draw 'text 330,900 "$name"' tag.jpg name_my.jpg` this results in image has text $name instead of content of name. i need read lines file , rund command on each name real script is(has same problem): arr=(`cat names.txt`) (( i=0; i<${len}; i+=2 )); `convert -pointsize 250 -font /usr/share/fonts/truetype/msttcorefonts/impact.ttf -fill black -draw 'text 330,900 "$(${arr[i]} ${arr[i+1]})"' tag.jpg name_${arr[i]}.jpg` done you have escaping problem. either use proper escaping backslash, or make sure otherewise $args not "protected" single quotes. e.g. name="bla" # using escape character \ value1="foo \"${name}\"" # putting single-quotes inside doubl

camera - why particles move backwards when camare get close? -

i have particle system(three.js) size set 40 when camera gets close them move backwards until disappear, normal how can change that? want them stay still in case it's because trackballcontrols making camera looking @ center. if zoom in end camera behind center still looking @ center.

Wordpress dynamically add hook to theme template.php -

is there way dynamically add hooks themes template.php, in top-a, or bottom-b? you can try register in hook. hook setup_theme called before theme functions.php included , after_setup_theme afterwards. so register 1 hook registers other hooks. see well: wordpress 3.0 program flow file inclusions

Linkedin integration onNewIntent() is not called in android Tabs -

i working on app , in tabhost have share setting activity.. integratin twitter, facebook , linkedin in app.. now, have problem in linkedin @override protected void onnewintent(intent intent) { log.v("finish", "finish authenticate.."); finishauthenticate(intent.getdata()); } is not called because used tabhost. without tabhost working perfectly.. i apply change in manifest file android:launchmode="singletop" , android:launchmode="singletask" android:launchmode="singleinstance" bt it's not working @ all.. following code working perfect me by following code have done 100% tested public class shareinlinkedin extends activity implements onclicklistener { private linkedinoauthservice oauthservice; private linkedinapiclientfactory factory; private linkedinrequesttoken litoken; private linkedinapiclient client; public static final string linkedin_pref = "gameprefs"; @suppresslint({ &quo

c++ - Extern template with variadic arguments doesn't compile -

i try create extern template variadic arguments like: extern template<typename... xs> void log( xs... xs ); but gcc 7.2 doesn't compile it, , show error: error: expected unqualified-id before ‘<’ token i check gcc status in c++11, , extern templates should work, isn't it? the extern keyword different expect - if understand correctly expect, of course. the extern keyword applied explicit instantiations of template, , prevents compiler generating implicitly code template while processing translation unit. per paragraph 14.7.2/2 of c++11 standard: there 2 forms of explicit instantiation: explicit instantiation definition , explicit instantiation declaration. an explicit instantiation declaration begins extern keyword . without extern keyword, compiler generate code (say) log(double, int) in each translation unit contains calls log(double, int) , , code - , should identical translation units - merged linker (the linker discard duplica

javascript - Editing a gridview cell using Modal which is shown using rel attribute -

i open (css made)modal dialog using rel="#showeditmodal" attribute of button. i used add values database update gridview , got working @ last. problem need edit values when clicked upon in gridview. it this: <asp:templatefield> <itemtemplate> <asp:button id="btneditdep" rel="#showeditmodal" cssclass="btn showmodal" runat="server" causesvalidation="false" text="test" onclientclick="window.scrollto = function(x,y) { return true; };" /> </itemtemplate> </asp:templatefield> this pretty screws me because need send variable(id) modal 1) if put inside grid_rowcommand won't go there until after modal shows tried putting value inside viewstate => can't seem able extract value gridview 2) tried open modal dynamically adding attribute ("rel","#showeditmodal") dynamically inside grid_rowcommand apparen

lucene.net - Sitecore Search Lucene Ranking -

how can set priority of fields when i'm searching lucene .net for example have : item 1 field 1 =contain "search text" field 2 ="bla bla" item 2 field 1 = "loren ipsun" field 2 = contain "search text" what should have on results, top item : item 1 first list, item 2 second one,etc. i think understand question. want have hits on specific field boosted more on field , can use boostfactor. can boost query using search in field one. example if use query qryname = queryparser.parse(keyword) can following: qryname.setboost(1000f); this boost hits on specific part of search specified in query. should therefor use 2 query's both fields , boost first query in search field 1. can vary in boostfactor untill suits needs. hope helps ;)

python - Iterating through a dictionary using dates -

can 1 me how iterate through dictionary dates, have data set this data=[{u'a': u'd', u'b': 100.0, u'c': 201l, u'd': datetime.datetime(2007, 12, 29, 0, 0), u'e': datetime.datetime(2008, 1, 1, 6, 27, 41)}, {u'a': u'w', u'b': 100.0, u'c': 201l, u'd': datetime.datetime(2007, 12, 29, 0, 0), u'e': datetime.datetime(2008, 2, 4, 6, 27, 41)}, {u'a': u'w', u'b': 100.0, u'c': 202l, u'd': datetime.datetime(2007, 12, 30, 0, 0), u'e': datetime.datetime(2008, 1, 1, 4, 20, 44)}, {u'a': u'd', u'b': 100.0, u'c': 202l, u'd': datetime.datetime(2007, 12, 30, 0, 0), u'e': datetime.datetime(2008, 3, 11, 6, 27, 41)}, {u'a': u'd', u'b': 100.0, u'c': 202l, u'd': datetime.datetime(2007, 12, 30, 0, 0), u'e': datetime.datetime(2008, 5, 8, 11, 2, 41)

java - Capitalize first word of a sentence in a string with multiple sentences -

eg: string s="this a.line .over " should come out "this a.line is.over" i thought of using string tokenizer twice -first split using"." -second split using " " first word -then change charat[0].toupper now i'm not sure how use output of string tokenizer input another? also can using split method generate array tried string a="this is.a boy"; string [] dot=a.split("\\."); while(i<dot.length) { string [] sp=dot[i].split(" "); sp[0].charat(0).touppercase();// part? use stringbuilder, no need split , create other strings, , on, see code public static void main(string... args) { string text = "this a.line is. over"; int pos = 0; boolean capitalize = true; stringbuilder sb = new stringbuilder(text); while (pos < sb.length()) { if (sb.charat(pos) == '.') { capitalize = true; } else if (capitalize &

java - Eclipse fails to launch (RSEUIStartup) -

hello :) posting here know if of have encountered problem before: eclipse fails launch, here .metadata/.log file workspace: http://pastebin.com/beuwasq4 it happened after ui began malfunctioning after line of length 1 500 000 got printed console (which had configured roll on 800 000 bytes, 100 000 default) i think key error in log file @ org.eclipse.ui.workbench plugin startup (line 42: rseuistartup ) imho ui fails launch because can't handle console again. guys know how reset ui display outside eclipse? edit: problem solved, aaron! beginning panic after new install of eclipse crashing. used this answer restoring launch configurations had. i'm not sure plugin causes problems here when eclipse fails launch, should: enable console , debugging. start eclipse -console -consolelog -debug make sure eclipse uses java , not javaw start. otherwise, won't see output. to tell eclipse want debug, create file .options in same folder eclipse.ini . .option

xcode - Running mach_inject with Qt in OSX Mountain Lion -

on osx mountain lion i'm able compile mach_inject , included test project. works expected injection functioning perfectly. i'm trying use same mach_inject framework qt project, compiled qtcreator . i've tried both clang , gcc compilers. everything compiles , application runs, when calling mach_inject, error: mach_inject failing.. (os/kern) invalid address tracing mach_inject , failure occurs @ last step, when calls thread_create_running . does know problem here? i'm assuming it's compiler options provided qt against used xcode, totally wrong! thanks. the problem turned out 32 / 64 bit incompatibility - (naturally) can't inject 64bit bundle 32 bit app! if else has similar problems, debugging mach_inject_bundle_stub can of use, same error kernel can presented due other issues.

c++ - Mersenne twister warm up vs. reproducibility -

in current c++11 project need perform m simulations. each simulation m = 1, ..., m , randomly generate data set using std::mt19937 object, constructed follows: std::mt19937 generator(m); datasetfactory dsf(generator); according https://stackoverflow.com/a/15509942/1849221 , https://stackoverflow.com/a/14924350/1849221 , mersenne twister prng benefits warm phase, absent in code. report convenience proposed snippet of code: #include <random> std::mt19937 get_prng() { std::uint_least32_t seed_data[std::mt19937::state_size]; std::random_device r; std::generate_n(seed_data, std::mt19937::state_size, std::ref(r)); std::seed_seq q(std::begin(seed_data), std::end(seed_data)); return std::mt19937{q}; } the problem in case need reproducibility of results, i.e., among different executions, each simulation, data set has same. that's reason why in current solution use current simulation seed mersenne twister prng. seems me usage of std::random_device p