Posts

Showing posts from February, 2015

ios - Can't insert object in the array, that I want add to User Defaults -

i have initialization of array var defaults = nsuserdefaults.standarduserdefaults() var initobject: [cpaymentinfo]? = defaults.objectforkey("paymentdata") as? [cpaymentinfo] if initobject == nil { initobject = [cpaymentinfo]() defaults.setvalue(initobject, forkey: "paymentdata") } defaults.synchronize() and have controller, contains 2 text labels , 2 buttons: save , cancel (both calling segue) if sender as? uibarbuttonitem == savebutton { var defaults = nsuserdefaults.standarduserdefaults() var payments: [cpaymentinfo]? = defaults.objectforkey("paymentdata") as? [cpaymentinfo] var newpaymentitem: cpaymentinfo? if discriptionfield.hastext() { newpaymentitem = cpaymentinfo(value: (valuefield.text nsstring).doublevalue, discription: discriptionfield.text) } else { newpaymentitem = cpaymentinfo(value: (valuefield.text nsstring).doublevalue)

android - Mockito AbstractMethodError on initMocks -

so i've been struggling pretty day trying mockito work android project. added gradle build file: androidtestcompile 'org.mockito:mockito-core:2.0.29-beta' androidtestcompile "junit:junit:4.12-beta-3" androidtestcompile 'com.google.dexmaker:dexmaker:1.2' androidtestcompile 'com.google.dexmaker:dexmaker-mockito:1.2' and have tried running test doesn't anything: @runwith(mockitojunitrunner.class) public class loginactivitytest extends activityinstrumentationtestcase2<loginactivity> { private loginactivity loginactivity; private edittext et_email; private edittext et_password; private button btn_login; @mock spicemanager manager; public loginactivitytest(){ super(loginactivity.class); } @override public void setup() throws exception { super.setup(); loginactivity = getactivity(); mockitoannotations.initmocks(this); //manager = mock(spicemanage

reporting services - Adding from two different reportitems -

i trying add 2 separate text boxes different datasets had create code summarize (codes below) giving total. trying gaptotal + gaptotal2 separate dataset. unfortunately blank. can help? thank in advance public gaptotal integer = 0 public function sum(byval value integer) integer gaptotal = gaptotal + value return value end function public gaptotal2 integer = 0 public function sumit(byval value integer) integer gaptotal2 = gaptotal2 + value return value end function there 2 possible approaches l can think of here. first reference values in each dataset , add values see posting - stack overflow posting second place values each data control eg text box, add values in each text box see - sql server central posting

file processing - Handle Commas While Reading Text in Python -

my code trying read log files throughout specified directory in rootdir , write pieces of information log file outputfile the issue i'm having searchobj_archive_date.group() , fullpath , zdiscsvar , zcopiesvar , , searchobj_year_3or6.group() aren't being read file lines within log files. happens 10% of total outputted lines of text, i'm confused why it's happening of time, instead of e:\filepath\text.txt | 5/23/2015 12:00 | c:\anotherfilepath\text.txt | 23 | 23 | 5year , e:\filepath\text.txt | | | | | any insight why error occuring appreciated. code below: after doing researched, found what's causing error whenever line has comma , in it. stops reading line @ comma , skips next line, know workaround this? an example of input text that's giving me problems: 11/23/2015 12:34:58 adding file d:\fp\fp1\fp2\text, text, text.txt normally these lines don't have commas, know of way handle commas when reading in lines of text? import os imp

jquery - Form validation error message not working -

i had custom code added shopping cart worked beautifly. @ point, error message displays when required field not filled out, stopped working. here code: (revised html included) {% assign choices = "other, affiliate, returning customer, practitioner, dr. ulan, dr. shallenberger, dr. dennis courtney, wbai - take charge of health radio, chek institue, bodyhealth newsletter, yasmine marca, ben greenfield, steve ilg, tawnee prazak, abc4u, natural awakenings, email advertisment, facebook, twitter, google, forum, friend, letter, optimum healt report, townsend letter, autism avenue" %} {% assign required = true %} <div class="form-vertical"> <p> <select style="margin-left: 0px;" class="six columns" id="how-did-you-hear-about-us" name="attributes[how-did-you-hear-about-us]" > <option value=""{% if cart.attributes.how-did-you-hear-about-us == "" %} selected{% endif %}>please make sele

Powershell command prompt prints ^C when pressing Ctrl+C, why? -

my command shell of choice powershell, have couple of windows open run scripts. i have noticed @ point shell starts misbehaving in annoying way: press key - nothing output! press 1 - works fine , rest of keys processed expected until hit enter execute. command runs, new command prompt appears , again first key ignored! pressing ctrl+c displays ^c instead of cancelling current prompt , showing new one. the strangest thing shell starts fine, works time, gets botched in aforementioned way , after period of time returns working fine. this extremely confusing, had botched shell instance when started question, fine. has encountered similar thing? causing it? edit i use console shell exclusively, not ise. shortcut command is: %systemroot%\system32\windowspowershell\v1.0\powershell.exe the shell version is: ps c:\> $psversiontable name value ---- ----- psversion 3.0 wsmanstackversion

javascript - codeigniter calendar: how to get the selected date? -

Image
i trying modify codeigniter calendar in order give separate add button every cell. when add button clicked pop displayed particular date auto filled in pop up. want selected date when click add button. my calendar this. i used following model function create calendar function mycal_model() { $this->conf = array( 'show_next_prev' => true, 'next_prev_url' => base_url() . 'index.php/dashboard/index/' ); $this->conf['template'] = ' {table_open}<table cellpadding="1" cellspacing="2" class="calendar">{/table_open} {heading_row_start}<tr>{/heading_row_start} {heading_previous_cell}<th class="prev_sign"><a href="{previous_url}">&lt;&lt;</a></th>{/heading_previous_cell} {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell} {he

asp.net - Control different views for website through query parameters -

i building asp.net mvc application has left navigation pane showing categories, , remaining page uses context of selected category actions. when navigate website http://website/home/index?category=1& hidecategories=true want hide navigation pane across actions till browser tab closed. want show navigation pane otherwise. how can achieve while supporting following scenarios, i want open 2 browser tabs side side 1 browser tab hiding categories pane while other browser tab showing navigation pane. if want isolation between tabs, per browser tab storage , can use session storage. using javascript can save value session storage this: sessionstorage.setitem("hidecategories", "true"); then can access value this: var x = sessionstorage.getitem("hidecategories"); if(x === "true"){ //some logic hide categories } you can set value per browser tab, can have 1 tab nav hidden , 1 tab not. data stored in sessionstorage no

android - How to scroll two-columns buttons in Activity -

Image
i can include 6 buttons , displays correctly . now want include more 6 buttons in scrollable view, can't handle matching available space, creating 2 rows (or columns if portrait). can provide way achieve this? references: i have composed button created using following code: public class imagebuttontext extends relativelayout { imagebutton button; textview label; holder holder; private void init() { layoutinflater li = (layoutinflater) getcontext().getsystemservice(context.layout_inflater_service); li.inflate(r.layout.big_button, this, true); button = (imagebutton) findviewbyid(r.id.button); label = (textview) findviewbyid(r.id.label); /*initialise button , label*/ } } and following xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" andr

c++ - Perfectly capturing a perfect forwarder (universal reference) in a lambda -

so have perfect forwarder, , want appropriately capture in lambda, such r-values copied in, , l-values captured reference. using std::forward doesn't job, evidenced code: #include<iostream> class testclass { public: testclass() = default; testclass( const testclass & other ) { std::cout << "copy c" << std::endl; } testclass & operator=(const testclass & other ) { std::cout << "copy a" << std::endl; } }; template< class t> void testfunc(t && t) { [test = std::forward<t>(t)](){}(); } int main() { testclass x; std::cout << "please no copy" << std::endl; testfunc(x); std::cout << "done" << std::endl; std::cout << "copy here" << std::endl; testfunc(testclass()); std::cout << "done" << std::endl; } compiling g++ -std=c++14 main.cpp produces output please no copy copy c

c++ - Why is an "empty attribute block" not allowed? -

this may dumbest question asked today regardless i'm going press on: the following derived class overloaded operator += , base class of overloads operator [] gives following compiler error : empty attribute block not allowed i write v[0] , v[1] in operator += of course, curious whether compile , if not, why not. what attribute block? why doesn't compiler resolve [0] [] operator, returning reference base class? question of syntax or deeper? #include <array> template<class t, int c> struct vec { typedef t value_type; typedef unsigned index_type; typedef unsigned size_type; std::array<t, c> v; template<typename ...args> explicit vec(args&&... args) : v({{args...}}) {} vec(std::array<t, c> const & o) : v(o) {} value_type & operator [] (index_type i) { return v[i]; } value_type const & operator [] (index_type i) const { return v[i

Apply jQuery.get() on dropdown menu -

Image
so, have dropdown menu using <ul> <li> menu </li> <ul> . now, 1 of items has large file size , thinking of applying jquery.get() reduce loading amount , speed until clicked. so, example, have following menu: <ul> <li> <button type="button"> <div class="_menu_title">map</div> </button> <ul class="dropdown_menu_sub"> <li class="dropdown_menu_sub_list"> <div class="google_map"> google map content goes here </div> </li> </ul> </li> </ul> here, when map button clicked, google map shown in menu. however, noticed slows down loading thinking unless map button clicked, don't want map content loaded. how can apply loading screen (to give user feedback happening) , load content using jquery.get()? you can ad

Php array to string conversion error with SLIM framework -

Image
i used php framework pass variable $data html page echo in loop here index.php : $result=$db->query('select * test'); while ($row=$result->fetch(pdo::fetch_assoc)) { $data[]=$row; } $app->render('form.php',$data)); and display form.php foreach ($this->$data $user) { echo $user['id']. '-' . $user['name'].'<br>' } i array string conversion error, idea ? tired var_dump($this->$data); instead of foreach loop , same error : array string conversion maybe $this->data instead of $this->$data foreach ($this->$data $user) { echo $user['id']. '-' . $user['name'].'<br>' }

gwt - Adding a dropdown or toggle button to DataGrid -

is there way add dropdown button or toggle button celltable or datagrid ? the documentation demonstrates using regular button ( buttoncell ). to add togglebutton grid, way found place button in panel (like flowpanel) add panel in grid. to found type of button, can visit showcase of gwt : http://samples.gwtproject.org/samples/showcase/showcase.html#!cwcustombutton here code have button in flowpanel : rootlayoutpanel rp = rootlayoutpanel.get(); flowpanel togglepanel = new flowpanel(); togglebutton toggle = new togglebutton("coucou"); toggle.setwidth("100px"); togglepanel.add(toggle); rp.add(togglepanel); css : .gwt-togglebutton-up, .gwt-togglebutton-up-hovering, .gwt-togglebutton-up-disabled, .gwt-togglebutton-down, .gwt-togglebutton-down-hovering, .gwt-togglebutton-down-disabled { margin: 0; text-decoration: none; background: url("images/hborder.png") repeat-x 0px -27px; -moz-border-radius: 2px; border-radius: 2px; } .

c# - Namespace '<global namespace>' contains a definition conflicting with alias 'PersianDate' -

i'm developing winform application in c# , fine. of sudden weird error when tried run application. namespace '' contains definition conflicting alias 'persiandate' this line throws error. private persiandate _quotationdate; all done before getting error add form_load event. private void frmadddragsource_load(object sender, eventargs e) { this.text = "source"; } does knows why happens , how can fix it? update usings: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.data.sqlserverce; using system.drawing; using system.linq; using system.text; using system.windows.forms; using fishtablighpro.utility; using persiandate = freecontrols.persiandate; since defined persiandate alias freecontrols.persiandate namespace. compiler can't tell whether persiandate refer namespace alias created, or persiandate type defined in it. try point directly persiandate t

javascript - How to word-wrap a URL? -

word wrap works on long strings without special characters. i'd use on url. rather filling columns in row, text goes next row on encountering special characters =, & etc. there other method solve this? html: <div style="word-wrap: break-word; width:100px;" id="foo"></div> js: var div = document.getelementbyid("foo"); div.innerhtml = "https://www.google.co.in/search?q=hello+world&ie=utf-8&oe=utf-8&gws_rd=cr&ei=anquvz7zk4kvuati3igidg"; js fiddle here . ps: overflow isn't nice! try using word-break: break-all; var div = document.getelementbyid("foo"); div.innerhtml = "https://www.google.co.in/search?q=hello+world&ie=utf-8&oe=utf-8&gws_rd=cr&ei=anquvz7zk4kvuati3igidg"; #foo{ word-break: break-all; } <div style="width:100px;" id="foo"> </div>

Delete empty csv files in directory - R -

have many csv files in folder (1.csv,2.csv....,20.csv) few of them empty (5.csv,8.csv). empty files contain size around 4 bytes , not size 0. need delete them in directory , want achieve in r. possible? appreciate help! the function countlines() r.utils package job: library(r.utils) lapply(filter(function(x) countlines(x)==0, list.files(pattern='.csv')), unlink)

Wizard link Target not rendering in front - Fluid/Extbase typo3 -

http://screencast.com/t/l3asbi2e - wizard link target not rendering in front front side code title but target not rendering afaik f:link.page viewhelper not interpret typolinks (that have). you should use viewhelper does, example v:link.typolink viewhelper extension vhs . you'd use this: {namespace v=fluidtypo3\vhs\viewhelpers} <v:link.typolink configuration="{parameter: youvariablehere}">linktext</v:link.typolink>

java - Write Compile Time Dependencies to a File -

i'm trying go through dependencies of project , write in custom file. i'm familiar way create fat jar, using 'jar' plugin, similar approach in custom task seems not work. some of code i've tried. // first way tried it. task customtask(){ file manifest = new file('file.txt') manifest << 'some text\n' manifest << 'dependencies:' configurations.runtime.collect{ manifest << it.name} } // second way tried it. task manifest(){ file manifest = new file('file.txt') manifest << 'header\n' manifest << 'dependencies:' filetree tree = filetree(dir: configurations.compile, include: '**/*.jar') tree.each {file file -> manifest << file } } the configuration object returned configuration.runtime filecollection interface, can readily iterate on it. why filetree(dir: xxx) didn't work, takes directory path , crea

qt - How to handle namespaces in C++? -

i have created dialogbox in qtdesigner //---------- *.h namespace ui { class mydialog; } class mydialog : public qdialog { q_object public: explicit mydialog(qwidget* parent = 0); ~mydialog(); private: ui::mydialog* ui; }; and source // --------- *.cpp mydialog::mydialog(qwidget* parent = 0) : qdialog(parent), ui(new ui::mydialog) { ui->setupui(this); //.. } i structure in namespace encapsulation, have com::example::mydialogs::mydialog like: //---------- *.h namespace com { namespace example { namespace mydialogs { namespace ui { class mydialog; } class mydialog : public qdialog { q_object public: explicit mydialog(qwidget* parent = 0); ~mydialog(); private: ui::mydialog* ui; }; }}} //namespace closing and source // --------- *.cpp namespace com { namespace example { namespace mydialogs { mydialog::mydialog(qwidget* parent = 0) : qdialog(parent), ui(new ui::mydialog) { ui->setupui(this);

java - How to rapidly play a sound when button is clicked(android) -

i'm trying play sound each time, button clicked. sound played need play every single time(like sound played when type something), problem is, mine isn't playing always. think because button clicked little delay. new mediaplayer sound = new mediaplayer().create(getapplicationcontext(), r.raw.sound); button.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { if (x >= ps.getx() && x < (ps.getx() + squares.getwidth()) && y >= ps.gety() && y < (ps.gety() + squares.getheight())) { ps.setres(psquareoffres); ps.setx(ps.getx() - squares.getwidth()); ps.sety(ps.gety() - squares.getheight()); ps.settouched(true); ps.lock(true); touchlimita = system.currenttimemillis(); timer = 3; sound.start(); break; } return false; } i glad o

google apps script - Get ID folder before importing data -

i have followed code how automatically import data uploaded csv or xls file google sheets , not explain how find folder id file has been uploaded to. i need provide spreadsheet template multiple users facilitate identification of folder, since have no way of knowing sure each user save csv file. wish avoid mistakes identifying destination folder. how can obtain id of folder user importing data?

jquery - Rails, How to mark an order as completed -

i need way apply method made order select. or find way mark complete. this tried far. don't mind trying new. have these orders display in view so: .col-md-12 .admindash %h1 admin dashboard .text-norm welcome admin dashboard here can see incoming , outgoing orders. .row .col-md-8 - order in @order %h2 = order.user.name .orderpanel .clientarea client name: = order.user.name %br client email: = order.user.email %br client address ... -->: %br = order.user.address_line_1 %br = order.user.address_line_2 %br = order.user.postcode %br = order.user.city %br = order.user.country .delivarea %br delivery_name: = order.delivery_name %br company_name: = order.company_name %br deli

ios - Facebook OAuthException when calling taggable_friends using Social Framework -

i using social framework fetch taggable_friends of user. when call api first time using below url working fine. [nsstring stringwithformat:@"https://graph.facebook.com/%@/taggable_friends", userid]; and response in format { "data": [ ... endpoint data here ], paging = { cursors = { after = qwfkq0llndf0s05vzaxbcswqxndm1mtfpbfbhzaxlyv2f5x2uxb1bpwdvtuu82lufyamzaywupfqtrfwxplskrzru9byxnuswvts2zaft21tdlnycxfcwxnpcuxor01snkd3uxzaymldyv1rutw9qcgczd; before = qwfjs2e3tgjdelflni04bldxrg4zcnvuexvyy2l0vgvvtk84u1vwdv9zaufjrb08ztf90d3zarxzjsb2tabfza6x2lmnuvqqxfsugh6nvjrbzfgrm9teldwzatdqak5cum9gm0vhtmvrzakrszafazzalezd; }; next = "https://graph.facebook.com/v2.3/996970000322616/taggable_friends?access_token=caaxvxrj0gjebafxammhzw4qotmq1uzbourwlyp1jfswoupptullrkihgoxlu0lqvyf6hoqumhb9pvuis9vekp6qlzch9sizdv1xteqsvr7rtjzxifpjzcdxztamdzcwvasmmibgidusuyofcl8sajbqlwlk57q1hwtpyjkb9wuxay2oo9zcujmuzcsmeufesvslopraraufbvfws

c++ - Initialize std::shared_ptr by copying a junk of data from a raw pointer -

basically hoping acheive: int pbuf = {1, 2, 3, 4, 5, 6}; std::shared_ptr<int> pptr(pbuf, _arraysize(pbuf)); the following syntax invalid, possible? i'm required use shared_ptr. if mean create copy of array pbuf , assign std::shared_ptr following code should work: int pbuf[] = {1, 2, 3, 4, 5, 6}; std::shared_ptr<int> pptr( new int[_arraysize(pbuf)], std::default_delete<int[]>() ); std::copy( pbuf, pbuf + _arraysize(pbuf), pptr.get() );

elixir - "dialyzer: Analysis failed with error.." (dialyzer bug? or wrong use of map-type?) -

working on simple application in progress of learning elixir, ran minor roadblock when checking types dialyzer. running dialyzer on code results in analysis failed error... far dialyzer has given me warnings , not errors when violate type spec's, have no clue error about. trying narrow down problem, made ultra simple function performs offending return value. @spec blabla(integer) :: %{atom => any} def blabla(1) %{:error => 'wrong input (us-state)'} end def blabla(2) %{ location: 'new york city, central park, ny', temp_c: '23.3', visibility_mi: '10.00', weather: 'a few clouds', wind_dir: 'north', wind_kt: '0' } end when running dialyzer on following error proceeding analysis... =error report==== 14-jul-2015::17:26:55 === error in process <0.31.0> exit value: {function_clause,[{erl_types,t_form_to_string,[{type,12,map_field_assoc,{type,12,atom,[]},{type,12,any,[]}}],[{

php - After JSON decode, all the values of one key is become zero -

i trying decode json encoded data following way.but values of post_count key 0 after decode. json encoded data not contain 0 array key. $news_users_data = @json_decode(file_get_contents("http://athavannews.com/?page_id=232365&datefrom=2015-07-02+00:00:00&dateto=2015-07-02+23:59:59"), true); you can check json encoded data pasting above url on browser , can see post_count key not include zero. var_dump $news_users_data, post_count key contain zero. why that? the decoding works fine. please dump result end watch carefully. of post_count set 0, because receive website. but, can find ex.: 15 => array (size=3) 'id' => int 35 'name' => string 'risha' (length=5) 'post_count' => string '2' (length=1) if there should more posts returned in count problem lays on website, in decoding json.

JavaScript's xor result different than the one of Java -

solution i had bug in internal conversion logic. original question i need implement algorithm both in java , javascript, whereas java implementation , calculation result reference. however, when invoking xor operator on "negative" value (i know java , javascript make use of 2's complement) causes java's result positive, whereas javascript result negative, shown in output below: java output: hash a: 16777619 hash b: 637696617 hash a: 637696613 hash b: 988196095 hash a: 988196062 hash b: -1759370886 hash a: 1759370917 <-- here javascript implementation behaves different hash b: -1169850945 javascript output: hash a: 16777619 hash b: 637696617 hash a: 637696613 hash b: 988196095 hash a: 988196062 hash b: -1759370886 hash a: -1759370843 <-- result should equal java result hash b: -1883572545 below can see java source code: private static final int fnv_prime = 0x1000193; pr

sql - pls-00103 error while executing a procedure -

i trying execute procedure shell script , ending in error: please me on this: default_shipment_date() { log_writer "$pgm_name" "[info] $pgm_name - in default_shipment_date function" sqlplus -s $ctgauth_login/$ctgauth_pwd@$ctgauth_tnsnames <<-eof >> $log_dir/${pgm_name}_${today}.log 2> $log_dir/${pgm_name}_${today}.err set serveroutput on begin execute default_shipment_date(); end; / exit eof log_writer "$pgm_name" "[info] $pgm_name - exiting default_shipment_date function" } the error message show below: thu jul 2 03:24:39 edt 2015) - [info] ctg_new_prds - in default_shipment_date function execute default_shipment_date(); * error @ line 2: ora-06550: line 2, column 9: pls-00103: encountered symbol "default_shipment_date" when expecting 1 of following: := . ( @ % ; immediate symbol ":=" substituted "default_shipment_date" continue. you not need use "execute&

php - default values for different mysql server version -

i have php project use self-made wrapper mysqli extension. works select , update , delete statements, not insert . for example have table 3 fields - id, name, surname. insert query looks this: $add = new sqlquery(); $add->addfield('id', 1); $add->addfield('name', 'alex'); $add->execute(); and fails always, because sql server has no default value surname field. mystery reasons code works on production server. are there differences default values setting different mysql server versions? or, there option or parameter, how can manage such behavior mysql server? you can either specify default value surname field or insert placeholder value yourself. an insert statement fail on mysql side otherwise. i'm not sure why working on production servers if there's no default value specified either on opinion it's bad practice leave such holes in data anyways. so if user didn't gave or haven't specified data should sto

inheritance - Does this C++ program invoke undefined behavior? -

i reading static_cast operator. consider following example: #include <iostream> class b { }; class d : public b { public: void fun() { std::cout<<"fun() called\n"; } }; void f(b* pb,d* pd) { d* pd2=static_cast<d*>(pb); b* pb2=static_cast<b*>(pd); pd2->fun(); } int main() { b b; d d; f(&b,&d); } it says that: in example follows, line d* pd2 = static_cast(pb); not safe because d can have fields , methods not in b. however, line b* pb2 = static_cast(pd); safe conversion because d contains of b. in contrast dynamic_cast, no run-time check made on static_cast conversion of pb. object pointed pb may not object of type d, in case use of *pd2 disastrous. instance, calling function member of d class, not b class, result in access violation. i tried on gcc 4.8.1 & msvs 2010 & output fun() called . program invoke undefined behavior? can progr

java - JBehave doesn't seem to execute the tests -

so it's first time jbehave , i'm trying create first jbehave in project appears test doesn't execute steps. in end test says test cases went through without problems in fact not executed @ all. set break points in every step method , debugger doesn't stop me @ not mention exceptions these steps throw. this scenario: narrative: in order user start using application, first needs register , log in scenario: successful registration given user email 'test@test.com' when user specifies password 'aaaaaa' user should registered email 'test@test.com' , hashed password 'aaaaaa' the steps: public class userregistrationsteps extends steps { @given("a user email '$email'") public void addnewuser(@named("email") string email) { user u = new user(); u.setemail(email); throw new runtimeexception("test"); } @when("the user specifies password '

Checking a website is accessible JQuery / Javascript -

Image
i trying use javascript, ping website, , display result this. i have set jsfiddle, no luck far. - https://jsfiddle.net/yyjowtru/ i feel close, seems if change following code (the url), nothing seem's change. // check if can see site $.ping("http://www.google.com").done(function (success, url, time, on) { // insert menu item linking sign-in page $("#menu-main-menu").append('<li><a target="_blank" href="#">sign in</a></li>'); // change width of li accommodate menu item $(".navbar li").css("width", "14.2857%"); }); can see obvious? thanks in advance edit screenshot of jsfiddle well forgot load jquery in fiddle. load , should work. try fiddle frameworks & extensions > choose jquery version want load https://jsfiddle.net/yyjowtru/1/

logging - log4net generates invalid xml -

i'm using log4net log in xml format. i'm using following configuration: <appender name="rollinglogfileappendererror" type="log4net.appender.rollingfileappender, log4net"> <file type="log4net.util.patternstring" value="app_log\service.error.xml"/> <staticlogfilename value="false"/> <preservelogfilenameextension value="true"/> <appendtofile value="true"/> <rollingstyle value="date"/> <datepattern value=".yyyy-mm-dd"/> <filter type="log4net.filter.levelmatchfilter"> <acceptonmatch value="true"/> <leveltomatch value="error"/> </filter> <filter type="log4net.filter.denyallfilter"/> <layout name="standardlayout" type="log4net.layout.patternlayout"> <header>&lt;?xml version=&quot;

android - how to stop running default sms app when one sms with special word receive -

how stop running default sms app example "go sms pro" when 1 sms special word receive,and app open sms. you can't. default sms app notified , "go sms pro" know code. you not have control on other applications.

hashtable - How does google's sparse hash table handle collisions? -

how google's sparse hash table handle collisions? i.e. when 2 elements map same bucket, how decide put new (colliding) element? i'm reading what main implementation idea behind sparse hash table? answer doesn't cover collision idea. your question answered in documentation here , specifically: 2c) if t.sparsetable[i % 32] assigned, value other foo, @ t.sparsetable[(i+1) % 32] . if fails, try t.sparsetable[(i+3) % 32] , t.sparsetable[(i+6) % 32] . in general, keep trying next triangular number. you can read triangular numbers here .

Swagger for a chat server over a websocket? -

i want write webapp has chat server component. i'll use swagger main rest api, want use similar chat server on websocket. i'm looking serialisation/deserialisation of messages, message validation, transport, etc. i.e. boring stuff. is possible use swagger this, or can people suggest else might me? @ moment chat server home made based on redis, might switch ejabberd or else if can find need. the answer no. swagger provides convention documenting api not implementing it. as per oficial documentation: the goal of swagger™ define standard, language-agnostic interface rest apis allows both humans , computers discover , understand capabilities of service without access source code, documentation, or through network traffic inspection. this means swagger in used build , visualize api documentation. what looking not api documenting tool. can achieve goal xmpp protocol library such smack. see here: http://www.igniterealtime.org/projects/smack/

c# - is it illegal to leech system dll code behavior and reimplement it? -

i need use slgetwindowsinformation in slc.dll rather implement own version pinvoking 200 times on application start , create datatypes need, illegal disassemble library , write own code leech behavior of function p.s i'm using c# won't inline assembly, ill copy behavior is illegal disassemble library , write own code that depends on are. there jurisdictions reverse engineering protected consumer right, , attempt prohibit in user agreement null , void. there jurisdictions reverse engineering not protected consumer right, , therefore may if license agreement allows it. if somewhere can reverse engineer legally, there may still restrictions other laws (such patents) on code produced, though patents can in way if don't copy , arrive @ idea in independent manner, along further innovations (though ironically patents designed encourage innovation). really, you're better off avoiding issue entirely , never @ code while you're trying same thing, unle

Is there an error with this IF statement? (Windows batch) -

so here odd thing. these if statements: if "%option%"=="1" goto 1-1 if "%option%"=="2" goto 1-2 if "%option%"=="3" goto 1-3 do work. however, these if statements: if "%option%"=="eat" goto eat if "%option%"=="drink" goto drink if "%option%"=="sleep" goto sleep if "%option%"=="suicide" goto suicide if "%option%"=="stats" goto stats do not. i know using more 1 character possible, because works @ beginning of prompt in these if statements: if "%startgame%"=="how2play" goto how2play if "%startgame%"=="play" goto play any idea why numbers working , not words?

linux - Crunch generate specific dictionary -

does knows if possible generate range of words in crunch has 10 characters letters (uppercase) , numbers, force have @ least 3 numbers? for example can easy generate passwords both (extremely huge list), don't need aaaaaaaaaa or bbbbbbbbbb. others aaa1aaaaaa or eeeeee2eee doesn't apply case. words aaa333aaaa or bbbbb245dd need. i have tried command crunch: crunch 10 10 "0123456789abcdefghijklmnopqrstuvwxyz" but give me huge list. does knows how this? thanks i don't think can. it's not difficult write program that'll able it. question is, worth you? right now, you're trying generate 36^10 numbers. on i5 , crunch , above command gives me ( crunch 10 10 "0123456789abcdefghijklmnopqrstuvwxyz" | pv >/dev/null ) output @ rate of 20mbps ~ 1906501 lines per second (20×2^20/11) , utilizing 2 out of 4 virtual cores. @ current rate, calculate of in 36^10÷(20×2^10÷11) seconds == 62,270 years` if modify algorithm ge

msbuild - Nuget restore not downloading dll in lib folder -

i have team city nuget build setup works fine. however, have tried update nuget packages, 1 of them being: microsoft.aspnet.mvc. updated version 5.2.2 5.2.3. this broke build. examining logs noticed nuget package restore seems didn't try install mvc. however, packages folder generated team city has microsoft.aspnet.mvc.5.2.3 folder there no dll file in lib folder. i'm @ loss here don't see why updating different package version breaks nuget restore. any insights on behavior? in advance. delete "microsoft.aspnet.mvc.5.2.3" package folder completely. nuget restore action should recreate folder , download assembly or assemblies correctly supposed in "lib". i've got exact same issue on build server , solved issue.

How to show an image on the LCD of ARM 9 processor? -

i need display image on lcd of arm 9 board. processor arm926ej-s , i'm running board on windows. i'm using code composer studio v4. there libraries can use purpose? i managed show colours on lcd using evmam1808_lcd_raster.c. displaying images similar this? here code used: #define lcd_width 320 #define lcd_height 240 #define color_blue 0x001f int x,y; raster_init(); for(y = 0; y < lcd_height; ++y){ for(x = 0; x < lcd_width; ++x) raster_plot(x, y, color_blue); } do need read image file , display on screen or there way of doing this? thanks in advance.

reactjs - How to use an array as option for react select component -

if wanna replace options <option value="a">apple</option> <option value="b">banana</option> in given example use of array in react jsx file,how proceed ? <select value="b"> <option value="a">apple</option> <option value="b">banana</option> </select> best regards blue because it's javascript, there million ways. way take map container generate guts. loop or whatever work fine. var answer = react.createclass({ render: function() { var data = ['this', 'example', 'isnt', 'funny'], makeitem = function(x) { return <option>{x}</option>; }; return <select>{data.map(makeitem)}</select>; } }; or in es6 in more modern react can just var answer = props => <select>{props.data.map(x => <option>{x}&l

c - 1.7 function of K&D book . How it calculate 2^0 when p is declared as 1 -

#include<stdio.h> int power(int m,int n); main() { int i; for(i=0;i<10;i++) printf("%d %d %d\n",i,power(2,i),power(-3,i)); return 0; } int power(int base,int n) { int i,p; p=1; // doubt in line for(i=1;i<=n;++i) p=p*base; return p; } when p declared 1 . how calculate value 2^0.yet i'm beginner of c programming can't able logic behind this.and doubt in function program how works 2^0 when p=1.thanks replay.. i'm assuming 2^0 mean inputs function power 2 , 0. in case, n = 0 , , loop doesn't run because i = 1 greater 0. in case, function returns 1 because initialized p 1, , loop didn't modify it.

ios - Dropdown animation in Swift - completion block error -

i following code listed here: dropdown list in swift namely: func animatedropdowntoframe(frame: cgrect, completion:() -> void) { if (!self.isanimating) { self.isanimating = true uiview.animatewithduration(0.5, delay: 0.0, options: .curveeaseinout, animations: { () -> void in self.dropdownview.frame = frame }, completion: {(completed: bool) -> void in self.isanimating = false if (completed) { completion() } } ) } } and keep getting errors on line completion: expected ',' separator expected member name or constructor call after type name note changed completion line since thought brackets in wrong place, don't think that's issue. what may issue (and what's best way have debugged on own)? the syntax, written, pretty hard follow. there may bug swift compiler makes unable parse wrote. swift allows nested funct

azure - Cannot repeatedly F5-deploy an OWIN Service Fabric application in VS 2015 RC -

steps reproduce: create application (in case, 2 stateless services following owin+web api tutorial, , leaving each instance count @ 1) f5-deploy start application -- works, , can see application in service fabric explorer shift-f5 in vs 2015 (rc) stop debugging -- application continues run in service fabric explorer f5-deploy again -- exception occurs in each stateless service, follows: system.reflection.targetinvocationexception unhandled user code hresult=-2146232828 message=exception has been thrown target of invocation. source=mscorlib stacktrace: @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolean constructor) @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments) @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ microsoft.owin.hosting.ser

angularjs - How to pass a function variable from a controller to a directive link? -

i trying evaluate variable through directive. how can pass variable found inside function controller directive link? able pass globally if variable set inside function says undefined. tried rootscope know avail. controller $scope.checkforcall = function(){ $http({ url: $locationprovider + 'broadcast_call', method: "get" }).success(function (data){ if(data != 'none'){ $scope.ccards = data.broadcast; $scope.hasdata = 1; } else { $scope.hasdata = 0; } }); } my directive app.directive('cards', function($timeout,$interval){ return{ restrict: 'eac', template: '<h1>not found</h1>', link: function($scope){ if($scope.hasdata == 1){ // undefine console.log("has data") }else{ console.log("not found") }

SSH: Understanding Algorithm Negotiation -

i'm writing ssh honeypot in java personal project. i'm having trouble understanding algorithm negotiation. precise, structure of received data client. here receive, personal annotations: 00 00 07 ac == packet length 08 == padding length 14 == ssh_msg_kexinit 6c 31 89 77 eb 54 e1 8b d4 b1 35 08 fd 52 65 6e == cookie 00 00 00 d4 == string length kex algorithms in byte form 00 00 01 67 == string length server host key algorithms in byte form 00 00 00 e9 == string length encryption_algorithms_client_to_server in byte form 00 00 00 e9 == string length encryption_algorithms_server_to_client in byte form 00 00 01 92 == string length mac_algorithms_client_to_server in byte form 00 00 01 92 == string length mac_algorithms_server_to_client in byte form 00 00 00 1a == string length compression_algorithms_client_to_server in byte form 00 00 00 1a == string length compression_algorithms_server_to_client in byte form 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0

How to get the options with which clang was compiled -

it possible gcc configure options gcc -v (an example here ). there similar way retrieve compilation options of clang? my real task following one: have environment compiler (clang) want improve. have patch clang applied , want rebuild patched sources, want sure nothing changes vanilla build apart patch; in particular, build flags use same. no, not. it's possible cxxflags/ldflags clang compiled via llvm-config . $ llvm-config --cxxflags -i/opt/compiler/llvm-trunk/include -march=native -fpic -fvisibility-inlines-hidden -wall -w -wno-unused-parameter -wwrite-strings -wcast-qual -wmissing-field-initializers -pedantic -wno-long-long -wcovered-switch-default -wnon-virtual-dtor -std=c++11 -ffunction-sections -fdata-sections -o3 -dndebug -d_gnu_source -d__stdc_constant_macros -d__stdc_format_macros -d__stdc_limit_macros $ llvm-config --ldflags -l/opt/compiler/llvm-trunk/lib $ llvm-config --system-libs -lrt -ldl -lcurses -latomic -lpthread -lz -lm if on linux distribu