Edit wont work in PHP/MYSQL [on hold]

Uncategorized
Question: my edit won't work. I am new to PHP/MYSQL so i need a little help. I also checked my phpmyadmin if there were changes, but i got noting. here is the edit form:// connect to the database include('db.class.php'); // call db.class.php $mydb = new db(); // create a new object, class db() // confirm that the 'id' variable has been set if (isset($_GET['id']) && is_numeric($_GET['id'])) { // get the 'id' variable from the URL $id = $_GET['id']; $conn = $mydb->connect(); $User = $mydb->getOne('SELECT * FROM remittance WHERE remitno = "'.$id.'"'); ?> and this is the edit code: include('db.class.php'); // call db.class.php $mydb = new db(); // create a new object, class db() $conn = $mydb->connect(); // new data $pname = $_POST['mydriver']; $pamount = $_POST['myamt']; $pgas = $_POST['mygas']; $id =…
Read More

How to use wit.ai with ogg files

Uncategorized
Question: I am trying to use the wit.ai speech to text so I will be able to convert recorded audio from whatsapp into text, The problem is that I keep getting error. wit.ai supports 'audio/wav', 'audio/mpeg3', 'audio/ulaw' and 'audio/raw' for the Content-Type header. In case audio/raw is used you also have to supply these parameters: encoding, bits, rate, and endian The file I am getting from whatsapp is .ogg. Since they don't support this kind of file I tried the audio/raw with all possible variations but I keep getting the same error: { "error" : "Bad request", "code" : "bad-request" } When I try a different type (audio/wav for example) I am getting a different error which makes sense: { "error" : "Mismatch between the provided content-type and the bytes…
Read More

Ng-click is not working with ng-bind-html in ng-repeat

Uncategorized
Question: I'm trying to get the data with using Jsonresult and Angularjs in MVC4. Jsonresult function in the Controller:public JsonResult GetQuestionSets() { //... var selectedData = titles.Select(y => new { //... qsAction = y.qtConfirm.Equals(false) ? "Edit" : y.Questions.All(z => z.qStatus == null) ? "Waiting" : y.Questions.All(z => z.qStatus == true) ? "Preview" : "Edit", }); return Json(selectedData, JsonRequestBehavior.AllowGet); } AngularJS to get result:$http.get('/Tutor/GetQuestionSets').then(function (response) { $scope.questionSets = response.data; }); $scope.trustedHtml = $sce.trustAsHtml;// Convert string to html View: //... //... My question is: Ng-click which is coming through the json result not working. But when I change the ng-click to onclick with simple function its working. Do you know why and solution? Answer: The ng-bind-html deals with pure DOM and not Angular directives like ng-click. Angular has no idea about to…
Read More

How to assign value from an Object to an element in jquery

Uncategorized
Question: I have these data fetched from an API call: I want to show these data to select option elements so I have this line of codes in my AJAX script file:$.each($(value.routes), function(index, route){ $('.searchable-select').append(' From: '+route+' '); }); How can I set the option value as 1 and 2 and the string ("From:...") as the text from this object? Answer: If you want to iterate the routes object, you can use the $.each of jquery. Codes look like this. var routes = { 1: "From Davao Del Sur (Phillipines) ...", 2: "From Soccsksargen (Phillipines)" } var select = ''; $.each(routes, function(index, route) { select += ''+ route +''; }) select += ''; $('#demo').html(select); Read more
Read More

Trying to load JSON via url in react-native but not getting correct response

Uncategorized
Question: getData() { return fetch("http://bitcfeedcms.rf.gd/script.php") .then(response => { console.log(response); response.json(); }) .then(responseJson => { this.setState({ data: responseJson }); }) .catch(error => { console.error(error); }); } I also tried by putting ?l=1 like " bitcfeedcms.rf.gd/script.php?l=1 ". The main jon file is " bitcfeedcms.rf.gd/feed_data.json ". So i tried "http://bitcfeedcms.rf.gd/feed_data.json?l=1" this too but nothing changed What i have to do now to get the json data and use it in my app...Please help Answer: http://bitcfeedcms.rf.gd/script.php , this link returns multiple sets of JSON. ([{"FeedTitle":"Debotos","FeedDescription":"First Feed Testing....."},{"FeedTitle":"Akash","FeedDescription":"Creating a clan named "Khulna Sparkers""},{"FeedTitle":"Ripon","FeedDescription":"My brother and my one of the closest individual"}]) try this . . . getData() { fetch("http://bitcfeedcms.rf.gd/script.php") .then(response => { console.log(response); response.json(); }) .then(responseJson => { var length = responseJson.length; for (var a = 0; a
Read More

Insertion Sort Function Error

Uncategorized
Question: In order to do this, the insert function will need to make room for value by moving items that are greater than value to the right. It should start at rightIndex, and stop when it finds an item that is less than or equal to value, or when it reaches the beginning of the array. Once the function has made room for value, it can write value to the array. var insert = function(array, rightIndex, value) { var key = value; for(var i = rightIndex; array[i] > value ; i = i - 1) { array[rightIndex + 1] = array[rightIndex]; } array[i+1] = value; }; Why My this function doesn`t work correctly after I input this array ! var array = [3, 5, 7, 11, 13, 2, 9, 6];…
Read More

Android ViewPager – How to show three panels at a time

Uncategorized
Question: I have an android project that my client is requiring me to have a ViewPager similar to the image below. Showing three panel at a time. The current selected panel will show full at the center, the panel before the selected one (if there is) will be shown half, and the panel after the selected one will be shown in half as well. Do you guys have any idea in how to do this? Still new in Android an im slowly getting lost when it comes to this kind of stuff? Here is the code that i have so far that will only show one panel. ViewPager viewPagerShopPortfolio = (ViewPager) mShopPortfolioImageAdapter = new ShopPortfolioImageAdapter(getChildFragmentManager(), portfolioListingModelList); viewPagerShopPortfolio.setAdapter(mShopPortfolioImageAdapter); And this is how my app looks like right now which only shows…
Read More

Identifying Row Index Number on the Bases of Max Value of Other Column within Group_by

Uncategorized
Question: G= c("P52" ,"P52","P66 - PARK II","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P82 V3","P82 V3","P52","P52","P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P82 V3" ,"P88","P88","P88","P52","P82 V3","P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P52","P88","P88","P52" ,"P88","P82 V3","P88","P82 V3","P82 V3","P82 V3","P88","P88","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P88","P66 - PARK II" ,"P88" ,"P52","P52","P52","P52","P52","P52","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II","P88","P82 V3","P82 V3","P88","P88","P66 - PARK II" ,"P66 - PARK II" ,"P52","P52","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II"…
Read More

how to match all the strings having a particular pattern between two other strings using regex

Uncategorized
Question: I want to extract all strings from "Timestamp:" to "Parameter" If I encounter any String ending with "Exception:" between "-a" to "site" where '-' is the character preceding "nTimestamp" aaaaaaaaaaaaaaaaaaaaaaaaaaaaa Timestamp: 8/10/2017 3:11:53 AM Message: System.ArgumentNullException: site parameter is missing from distributed cache namespace Parameter:name: site Answer: you can use the regex (Timestamp.*n*.*Exception.*n*)(?=Parameter) which would capture your result in the first group, see the demo here Read more
Read More

Float left and Float Right in Fixed element

Uncategorized
Question: HTML: image of page goes here Navigation of page goes here Am no an listening depending up believing. Enough around remove to barton agreed regret in or it. Advantage mr estimable be commanded provision. Year well shot deny shew come now had. Shall downs stand marry taken his for out. Do related mr account brandon an up. Wrong for never ready ham these witty him. Our compass see age uncivil matters weather forbade her minutes. Ready how but truth son new under. Breakfast procuring nay end happiness allowance assurance frankness. Met simplicity nor difficulty unreserved who. Entreaties mr conviction dissimilar me astonished estimating cultivated. On no applauded exquisite my additions. Pronounce add boy estimable nay suspected. You sudden nay elinor thirty esteem temper. Quiet leave shy you gay off…
Read More

Formating attributes in Nifi

Uncategorized
Question: I want to format Date attribute so that each flowfile has name like this 2001-12-01. I use this code below , but it gives me exception : "can not cast jdk.nashorn.internal.runtime.undefined" var flowFile = session.get(); function addDays(date, days) { var result =formatDate(new Date(date)); result.setDate(result.getDate() + days); return formatDate(result); } /* function sliceDateString(dateStr) { return dateStr.slice(0, dateStr.indexOf('T')); }*/ function formatDate(date) { var d = new Date(date), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; return [year, month, day].join('-'); } if (flowFile != null) { var startDate= flowFile.getAttribute('startDate') var endDate= flowFile.getAttribute('endDate') var parameter=flowFile.getAttribute("parameter") var dateToStart=new Date(startDate); var dateToEnd=new Date(endDate); var tr=dateToEnd.getDate()-dateToStart.getDate(); if(tr>=parameter) { var flowFile1=session.create(); dateToEnd…
Read More

Error:(23, 13) Failed to resolve: com.google.android.gms:play-services:11.2.0 “Install Repository and sync project” dose not work

Uncategorized
Question: I am try to get location and update to server on my android apps. this is my Gradle code, here i incude "compile 'com.google.android.gms:play-services:11.2.0'" this line, that provide from google : dependencies { compile 'com.google.android.gms:play-services:11.2.0' compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support:support-v4:25.3.1' } But give this error :Error:(23, 13) Failed to resolve: com.google.android.gms:play-services:11.2.0 Install Repository and sync project Show in File Show in Project Structure dialog "Install Repository and sync project" is link but it dose not working. Answer: Add this to your project-level build.gradle file:repositories { maven { url "https://maven.google.com" } } Read more
Read More