datatable ajax send data values in array

ajax
Question: i tried using ajax/datable/codeigniter and i want to send my data in post like array data for example (search['value'] = searched_key). function fetch_vtourdata( is_range_search, minPrice = '', maxPrice = '', minSurface = '', maxSurface = '', minNbRoom = '', maxNbRoom = '', searched_key = '') { var dataTable = $('#data_tableVtoursList').DataTable({ "processing": true, "serverSide": true, "order": [], "ajax":{ url: "../../website/userVtourTable", type: "POST", data: { 'user_id': user_id, // 1 = name of POST, 2 = values is_range_search:is_range_search, minPrice:minPrice, maxPrice:maxPrice, minSurface:minSurface, maxSurface:maxSurface, minNbRoom:minNbRoom, maxNbRoom:maxNbRoom, search[{ 'value':searched_key }] } }, "columnDefs" : [ { "target": [0, 3, 4], "orderable": false, } ] }); $('#search').keyup(function(){ dataTable.search($(this).val()).draw(); }); } enter image description here Answer: Read more
Read More

Can’t export mysql table via js script

Uncategorized
Question: I can export html table but cant export php table via js. When pressing button it starts download clean excel file(should be table "sanoat").Whats my problem ? Sorry im newbie. Maybe there is another way to do it ? I know PHPExcel method to get from mysql into excel , but it saves excel in server directory. I need button where you press and it ask where to save excel file with all your table in it. Answer: Read more
Read More

How should I overcome from this hibernate error of java Write operations are not allowed in read-only mode

Uncategorized
Question: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. at org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1135) Answer: In you spring context part, set the following. I think your current is set as : Also you can set @Transactional(readOnly = false) to ur class method (let's say DAO Class methods like persist, update or delete) which need to write in database. @Transactional(readOnly = false) public void UpdateEmployee() { ... ... } Read more
Read More

How do you render content from a CMS with React?

Uncategorized
Question: My react app gets content from Wordpress. The editors can add content to WP's editor where they can style the text and format it. How do I render this text on the client site with react? So far I have tried using dangerouslySetInnerHTML, but the name suggests to me that I shouldn't be using it - at least not very often, but all my content comes from Wordpress. So is there another way of rendering HTML strings in react? Answer: You can use dangerouslySetInnerHTML, it is Reacts replacement for using innerHTML in the browser DOM. In general, setting HTML from code can be a bit risky because you can inadvertently expose your users to XSS attacks (cross-site scripting). You can set HTML directly from React, but you type the…
Read More

Codeigniter returning code 0 db errors without message

Uncategorized
Question: I have a query that is supposed to return an error message like this:Error Number: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`sservice_dev_mercury`.`agent_accounts`, CONSTRAINT `agent_role_fk` FOREIGN KEY (`role`) REFERENCES `roles` (`id`)) DELETE FROM `roles` WHERE `id` = '3' This is when db_debug is true. When I turned it false and used $error = $this->db->error(); return $error; I get error 0 with an empty message. Is there something I am missing when trying to get the errors? This is the query:public function delete($id){ $this->db->trans_begin(); $this->db->where('id',$id); $this->db->delete($this->table); $this->db->trans_complete(); if($this->db->trans_status()===false){ $this->db->trans_rollback(); $error = $this->db->error(); return $error; }else{ $this->db->trans_commit(); return true; } } Can someone take a look and see if something went wrong? Answer: Read more
Read More

Create a report on ID badging occurences

Uncategorized
Question: I am trying to create a readable report within excel that takes a monthly excel document when employees badge a specific RFID reader to be like a "sign in" type of output. So if John Doe badges a reader between 11am to 1pm, it counts as 1. If John Doe badges that same reader between 4pm to 6pm, it counts as 1. If John badges every Wednesday twice, at the end of a month with 4 Wednesdays, a total will show that he badged 8 times. Below is the data straight from the report: Occurrence Time                 Cardholder Name 2017-08-14 3:53:20 PM                 Doe, John 2017-08-14 3:53:23 PM              …
Read More

how do i pass this on my xaml.cs [on hold]

Uncategorized
Question: my xaml it appears I can see my content in XAML but I get a blank page when I run my source code DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}" d_DataContext="{Binding Source={d:DesignData Source=/viewmodal/SampleData.json}}" mc_Ignorable="d" my XAML.cs when I run my code doesn't appear anything so I think I need to add something in the code behind like observstioncollection or navigation.how do I write that code here!? public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } Answer: Read more
Read More

How to make this piece of code asynchronous via promises?

Uncategorized
Question: Any Glue. Please do not give example of SETTIMEOUT. My supervisor said that it is unnecessary having more then() statement if the then()'s do not return any new promise.I could not get it completely, I have looked at Exploring ES6 but there is no very well example of my situation. let readData = new Promise(function (resolve, reject) { fs.readFile('/home/geek/Desktop/activity-logs.csv', 'utf8', (err, data) => { if (err) reject(); resolve(data); }); }); readData .then((data) => { bankLogs = splitString(data, ';') }) .then(() => { for (let index = 2; index < bankLogs.length; index += 5) { objectOfUsers[bankLogs[index]] = {} temporarySymbols.push(bankLogs[index].concat(bankLogs[index + 1])); } Object.keys(objectOfUsers).forEach(function (element) { objectKeys.push(element) }); for (let index = 0; index < objectKeys.length; index++) createObject(index); console.log(objectOfUsers) }) .catch((err) => console.log('Error happened : ' + err)); Run code snippetHide…
Read More

How to extract, using cmd, string between quotes from a particular line

Uncategorized
Question: Hope I will be clear with my problem and what I search for. I have a long script in a .sjs file (basically txt with different extension), part of which are the following lines var Want_spring_aid_file_update = 0; var Front_spring_aid_file = "name_1.pspck"; var Rear_spring_aid_file = "name_2.pspck"; I have been looking around for a .bat script that can probe certain lines, 2 and 3 in the case above, in this .sjs file and write the string between quotes in a text file. I have found on this marvelous website a script that outputs all the strings between quotes in that file. I want just on particular lines. The script I am talking about is below. >"output.txt" ( for /f usebackq^ tokens^=2^ delims^=^" %%A in ("input.txt") do echo "%%A" ) Also…
Read More

R svyby gives error but svytotal works

r
Question: I am creating descriptive statistic of a dataset and when I run the following it works svytotal(~interaction(w4_prov2011,w4_c_grcurtyp),design=LFCP4.W,na.rm=TRUE) but the following gives an error svyby(~w4_c_grcurtyp,~w4_prov2011,design=LFCP4.W,svytotal,na.rm=TRUE) Error in tapply(1:NROW(x), list(factor(strata)), function(index) { :arguments must have same length Is that possible? Answer: Read more
Read More

Sort data coming from phone storage in alphabetical format?

Uncategorized
Question: I am beginner in android.I am trying to get audio files from storage and put it in recycler view.And it loads perfectly but,i don't know how do i sort that whole list in alphabetical order of that file name.I have tried some ways but it did not worked. Please help me to solve this.Thank you. This is My Java file: Recycler_MusicPlayer.java:public class Recycler_MusicPlayer extends Recycler_Music_Player_onclick { // private RecyclerView recyclerView; Adapter adapter; Cursor musiccursor; int music_column_index; int count; FastScrollRecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recycler__music_player); setTitle("List of Songs"); recyclerView = (FastScrollRecyclerView) findViewById(R.id.recycler); recyclerView.setLayoutManager(new LinearLayoutManager(this)); System.gc(); String[] proj = {MediaStore.Audio.Media._ID, MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Video.Media.SIZE}; musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, null, null, null); count = musiccursor.getCount(); adapter = new Adapter(this); recyclerView.setAdapter(adapter); } public class Adapter extends RecyclerView.Adapter { private Context…
Read More

How do I expand comma separated values into separate rows using SQL Server 2005?

Uncategorized
Question: I have a table that looks like this:ProductId, Color "1", "red, blue, green" "2", null "3", "purple, green" And I want to expand it to this:ProductId, Color 1, red 1, blue 1, green 2, null 3, purple 3, green Whats the easiest way to accomplish this? Is it possible without a loop in a proc? Answer: Take a look at this function. I've done similar tricks to split and transpose data in Oracle. Loop over the data inserting the decoded values into a temp table. The convent thing is that MS will let you do this on the fly, while Oracle requires an explicit temp table. MS SQL Split Function Better Split Function Edit by author: This worked great. Final code looked like this (after creating the split function):select…
Read More

VBA Pdf Excel with ShellExecute not pasting to Excel

Uncategorized
Question: I've been trying to get VBA in Excel to copy a PDF to Excel. I tried different things, which I list below in case someone wants to try some fortune: I tried also the code here, which indicate to enable the reference, but this seems to only work if you have Acrobat pro installed. Use Shell and ShellExecute: I tried the code here, but I kept getting an error when the pdf was opening saying that it could not find the file. I tried using ShellExecute following commentshere and code here, but I couldn't manage to make it work. Finally, using ShellExecute I found a code here that allows me to open the pdf file without error Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As…
Read More