Posts

Microsoft Surface Emulator?

Image
Clash Royale CLAN TAG #URR8PPP Microsoft Surface Emulator? Does anybody know about a way to emulate a microsoft surface? I am battling with some css issues on a Firefox Browser in a microsoft surface, but I am having a tough time finding a way to test it. Does anybody knows of a way to test for it? is it a case of simulating a windows operating system using firefox, or is that any tools, preferably free, that I can test o specific devices? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

RegEx In Header

Image
Clash Royale CLAN TAG #URR8PPP RegEx In Header i've a problem with a website. I cannot modify the html but i can, with regex, make some change to the code. The CMS take the first line of text and place it automatically in the header of the page in the meta description. If in the first part of the text there are some link the CMS don't clean the html and place the link in the header breaking the page. I was working on a regex to intercept the code and remove it. The example of the code is: <meta name="description" content="sometext<a href="">anchor text</a> and <a href="https://www.url.com/path1/path2">anchor</a>? a lot of text" /> The links in the text could be 1, 2, 3 or more. At the moment i've create the: (?:(<meta name="description" content="|<meta property="og:description" content="|<meta name="twitter:description" content="))(((?:[^<]|...

Buttons: download button with scroller downloads only few rows

Image
Clash Royale CLAN TAG #URR8PPP Buttons: download button with scroller downloads only few rows I am handling tables with more than 100 000 rows and using DT package ( development version 0.1.56 ) to visualize it in Shiny App. DT Furthermore I am using DT Extensions as: Buttons , to download the data in different formats. However while Scroller extension is as well activated, i am able only to download few rows (not all data). DT Buttons Scroller Sample code: library("shiny") library("DT") shinyApp( ui = fluidPage(DT::dataTableOutput('tbl')), server = function(input, output) output$tbl = DT::renderDataTable( iris,extensions=c("Buttons",'Scroller'),options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print'),scrollY = 50, scroller = TRUE )) ) Additionally if i run only this part of the code in R and get the datatable in the viewer, i am able to copy etc. all ...

How do you reference the checked value in a radio input control for a javascript function?

Image
Clash Royale CLAN TAG #URR8PPP How do you reference the checked value in a radio input control for a javascript function? I need the output element of an html form to display content that is based off whatever item is checked from a radio button set. When I only need to display which value is checked it works fine, but when I try to use a function to switch the output, the if statement doesn't work - the function always returns 'Farenheit' as though option.value remains 'celcius' (regardless of how often the option buttons are swapped): <script> function switchOpt(opt) if (opt='celcius') return 'Farenheit'; else return 'Celcius'; </script> <form oninput="swap.value=switchOpt(option.value)"> <input type="radio" name="option" value="celcius" checked /> Celcius <br /> <input type="radio" name="option" value="farenheit" /> Farenhe...

Bootstrap 4 dropdown menu within accordion

Image
Clash Royale CLAN TAG #URR8PPP Bootstrap 4 dropdown menu within accordion I am using Bootstrap 4 and accordion panels, within those panels i have tables and some inputs with dropdown menu's. From the snippet i have provided you can see that the dropdown doesn't show on top (over the other accordion) and just shows within the accordion. Does anyone know a way around this? <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" /> <script sr...

In knockout Change Paging when Data is changed

Image
Clash Royale CLAN TAG #URR8PPP In knockout Change Paging when Data is changed In knockout I wish to change/ refresh Paging when data is changed. For example: I have a data set of 100[5 Records per Page] and I am on Page 10. Now with some more search Data is changed from 100 to 5 and I am on Page 10, but when data is changed I want paging to be on First page. i.e Paging to be refreshed. Here is my [Fiddle] (https://jsfiddle.net/975ncawv/281/) MyVM.prototype.loadData = function(rawData) this.items(rawData.map(RowModel.fromRawDataPoint)); ; ko.applyBindings(new MyVM(myData)); 2 Answers 2 Two things need to be changed inside the loadData function. loadData all items pageNumber paginated all paginated It would look like this updated fiddle. but when data is changed this.items.subscribe( /* ... */ ) I want paging to be on First page this.pageNumber(0) Put together: this.items.subscribe(function() this.pageNumber(0); , this); I don't see any logic concerning the search dat...

Android Combine 2 Lists of data one from Room LiveData and 1 from Observable

Image
Clash Royale CLAN TAG #URR8PPP Android Combine 2 Lists of data one from Room LiveData and 1 from Observable I am building an app that for now have one main data model Character , I'm using Room as local DB and retrofit2 for API calls. The user can set a Character as favorite and when this happens this character is stored in local DB (only local DB know about favorite characters of a current user, this app does not store any data on remote servers just use API to get a list of characters). The question is when user load next time the app how to load the list from web and from local DB (Room return LiveData<List<Character> ) and filter out from web list Characters which stored in local DB with the help of RxJava2 (I can use Observable as return from retrofit2) so when I show the list in RecyclerView there will be no duplicates. Character LiveData<List<Character> Characters For better understand of what i mean: I have MainActivity which have MainViewModel , in ...

How to recreate the any? method in Ruby

Image
Clash Royale CLAN TAG #URR8PPP How to recreate the any? method in Ruby I am trying to recreate the enumerable module in Ruby. I am up to the any? method and having difficulty returning true or false. Instead each array item is returned 1 by 1.. Here is my code: def my_any? return self.to enum unless block_given? self.each do |i| return true if i == yield(i) end end nums = [3,5,7,3,6,10,20,16] puts nums.my_any?x==6 Any ideas where I am going wrong? 2 Answers 2 You have two issues: return false each return true if cond any? i == yield(i) yield(i) (The to enum bit sounds off too, but that's unrelated to your question.) to enum Slotting those changes into your code: def my_any? # FIXME: return self.to enum unless block_given? self.each do |i| return true if yield i end false end There's no need for self – Stefan Aug 10 at 13:24 self @Stefan there is always a need in self in our humble lives :) – mudasobwa Aug 10 at 18:54 self You hav...

How to pass jquery variables to another php file

Image
Clash Royale CLAN TAG #URR8PPP How to pass jquery variables to another php file I have the code below for Java Script on getwifi1.php $(function() $('#wifi-avail').on('click', 'td', function()); //end inner function ); //end outer function I want to transfer the value of user and pass to another php file named newone.php in which I have written this code <?php $name1 = $_POST['username']; $name2 = $_POST['password']; echo $name1; echo $name2; ?> but the $name1 and $name2 seems to be empty always. I don't know what I am doing wrong. Can anyone correct my method or write me another code to transfer these two variables from getwifi1.php to newone.php. I have search ajax method which I applied like this but it didn't seem to work either $.ajax( method: "post", url: "newone.php", data: username:user, password:pass ) ThankYou How do you know $name1 and $name2 are empty? – kerbholz Aug 10 at 11:10 $na...

angularjs text box must have max length digits

Image
Clash Royale CLAN TAG #URR8PPP angularjs text box must have max length digits I have 30 text boxes first text box must have 9 numbers and second text box must have 3 digits and I have code like this after first text box reached max length it moves to next text box. How can I achieve this? function numOnly() { var directive = restrict: 'A', scope: ngModel: '=ngModel' , link: link ; return directive; function link(scope, element, attrs) scope.$watch('ngModel', function (newVal, oldVal) arr[0] === '.')) return; if (isNaN(newVal)) //scope.ngModel = oldVal; scope.ngModel = ""; ); <tr ng-repeat="cl in codelist" ng-if="$odd" > <td>$index+1</td> <td> <label ng-model="codelist[$index].CodeNumber">codelist[$index].CodeNumber</label> </td> <td ng-class=" 'has-error' : codeForm.clHtnoA$index.$invalid && (codeForm.clHtnoA$index.$dirty ...

Mock package-level function in Kotlin with PowerMock

Image
Clash Royale CLAN TAG #URR8PPP Mock package-level function in Kotlin with PowerMock I have a file with some package-level functions in Kotlin. //Logger.kt fun info(tag : String, message : String) ... fun error.... I'm testing functions of a class that call functions of this kotlin file, and I would like to mock them. I know that package-level functions are like static methods in Java, so I've been thinking of using PowerMock. //MyClass: Class that calls Logger.kt functions class MyClass fun myFunction() info("TAG", "Hello world!") Any ideas? See stackoverflow.com/questions/47985836 for a similar question (the technique probably works for powermock too). – yole Mar 16 at 12:30 How MyClass and Logger are related: inheritance, composition? How do you instantiate Logger class? Is Logger.kt a class or a kotlin object? – Oleg Mar 16 at 22:26 @Oleg Logger.Kt is a kotlin object – jmartinalonso Mar 19 at 7:57 @jmartinalonso, in that...

lvalue required as left operand of assignment

Image
Clash Royale CLAN TAG #URR8PPP lvalue required as left operand of assignment Why am I getting lvalue required as left operand of assignment with a single string comparison? How can I fix this in C ? C if (strcmp("hello", "hello") = 0) Thanks! possible duplicate of "lvalue required as left operand of assignment " error – Bo Persson May 28 '11 at 15:22 6 Answers 6 You need to compare, not assign: if (strcmp("hello", "hello") == 0) ^ Because you want to check if the result of strcmp("hello", "hello") equals to 0 . strcmp("hello", "hello") 0 About the error: lvalue required as left operand of assignment lvalue means an assignable value (variable), and in assignment the left value to the = has to be lvalue (pretty clear). lvalue = lvalue Both function results and constants are not assignable ( rvalue s), so they are rvalue s. so the order doesn't matter and if you for...

How do I enable the encryption module in PHP SQLite3?

Image
Clash Royale CLAN TAG #URR8PPP How do I enable the encryption module in PHP SQLite3? I'm on a mac with a localhost server. I have a WebServer folder in my Library folder and that connects to 'localhost' and I'm not even sure how I did that but it works. I'm trying to connect to an encrypted database but it keeps saying that it's encrypted or doesn't exist. I conclude that I must not have the encryption module for SQLite3. How would I go about getting that? I'm very confused. Thanks in advance! By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Arithmetic right shift examples in my textbook shift in ones when the MSB was zero

Image
Clash Royale CLAN TAG #URR8PPP Arithmetic right shift examples in my textbook shift in ones when the MSB was zero I am currently studying assembly, and with it the workings of bitwise operations amongst them shifting. Specifically arithmetic rightshifting is bothering me. Now, in the book i am reading there are several practice problems, amongst them, I need to perform this operation on a byte consisting of: 0100 0100 Now, seeing as the arithmetic rightshift fills in the value of the most significant bit, it seems to me this should be right shited like so: 00001000 However, the book states that it should be 11101000 That is, 1's are filled in from the left instead of 0's. But wasn't the most significant bit a 0? well, there's another as well: 0110 0100 >> 3 = 0000 1100 But, apparently that's wrong as well, and it should be: 11101100 Again, I don't get it the most significan't bit value is clearly 0, the one the furthest to the left, yet the so...

Perl Mojolicious array loop

Image
Clash Royale CLAN TAG #URR8PPP Perl Mojolicious array loop Not sure if this is even possible. But I am trying to loop over an array. I keep getting the error message Can't use an array as a reference on the for loop line. $product_results->[6] does contain data. Can't use an array as a reference $product_results->[6] my @product_array = split(',', $order->[6]); $product_results->[6] = @product_array; % for (@$product_results->[6]) <%= $_->[0] %> % @$product_results->[6] should work. – Rajashekar Reddy M Aug 10 at 10:49 Thanks that worked. – user3525290 Aug 10 at 11:07 @RajashekarReddyM next time, write an answer to get some rep. Don't answer in comments. ;) – simbabque Aug 10 at 11:08 1 Answer 1 You are using both forms of dereferencing at once. Either use $ref->[6]; or @$ref[6]; Both at the same time will Perl dereference the reference as an array into something like this, and the...

pytest ScopeMismatch error: how to use fixtures properly

Image
Clash Royale CLAN TAG #URR8PPP pytest ScopeMismatch error: how to use fixtures properly For the following piece of code: @pytest.fixture(scope="module") def dummy_article(request, db): return mixer.blend("core.article", title="this one price", internal_id=3000) def test_article_str_method(dummy_article): assert ( str(dummy_article) == f"article with ID dummy_article.internal_id and title: dummy_article.title" ) I'm getting the following error: ScopeMismatch: You tried to access the 'function' scoped fixture 'db' with a 'module' scoped request object, involved factories core/tests/test_article_model.py:13: def dummy_article(request, db) The error goes away if I change the fixture to use scope="function" , but that defeats the purpose of having it available to other tests and not having to "set-up" for every test. scope="function" How can I have fixtures with db access that have a...

pause function not work mp3 file from firebase

Image
Clash Royale CLAN TAG #URR8PPP pause function not work mp3 file from firebase play.setOnClickListener(new View.OnClickListener() @Override public void onClick(View view) MediaPlayer mediaPlayer=new MediaPlayer(); try mediaPlayer.setDataSource("https://firebasestorage.googleapis.com/v0/b/photo-on-birthday-cake-cccf5.appspot.com/o/birthday%20(1).mp3?alt=media&token=c1e988b4-f482-4020-8057-53c68195d2fc"); mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() @Override public void onPrepared(MediaPlayer mediaPlayer) if(flag==0) mediaPlayer.start(); Toast.makeText(MusicActivity.this, "start", Toast.LENGTH_SHORT).show(); flag=1; play.setBackgroundResource(R.drawable.ic_pause_circle_outline_black_24dp); else mediaPlayer.pause(); Toast.makeText(MusicActivity.this, "Stop", Toast.LENGTH_SHORT).show(); flag=0; ); mediaPlayer.prepare(); catch (IOException e) e.printStackTrace(); ); I tried this code but this is not work...