mercredi 28 octobre 2015

Code a custimizble web page

I want to create a complex form that the user can customize the fields order(actually manager of a big group of employee), type, size etc. And even add or remove fields from it. But I'm not sure how to do it exactly.

I'm submitting the form to PHP from this form and I want the form to get change from the client side only (it can be pure JS/CSS/other client technology) so the manager could modify the form in a simple way.

1) I would like to create a "Structure" file (XML/other) like this

<XML>
<page 1>
   <option 1 type=text mandatory=true>
   <option 2 type='drop-box' src='http://www.d.com/rest' mandatory ='false' dst=''>
<page 2>
   <option 3 type=text mandatory=false>
   <option 4 type=text mandatory=false>
<XML>

2) and a local webpage form that will load it

<html table>
   <options in page 1 by the type >
<html table>
   <options in page 2>
<submit>

3) and the logic using JS

<forcing mandatory true and more logic>

Is that possible to make a complex form and let a user modify the instructor and fields order and type like that?




MySQL not using data from php function? [duplicate]

This question already has an answer here:

The function is not working. I would like ot add each line to the mysql database to the description field, and a number to the value field

 $fp = fopen($filename,"r");
    $number=0;

    //parse the csv file row by row
while(($row = fgetcsv($fp,"500",",")) != FALSE)
{
    $number++;
    //insert csv data into mysql table
    $sql = "INSERT INTO 'description' (descID`, `desc`) VALUES($number ,$row)";
    if(!mysqli_query($connection, $sql))
    {
        die('Error : ' . mysqli_error());
    }
}




my php form have a three text box each text box have ID and Name.

my php form have a three text box each text box have ID and Name. The ID and Names are dynamically created (like my student id is act as text box ID with the help of php. Name also from Database), Right now i need to calculate student marks from all the three boxes but the three box ID is dynamic now how to retrieve using java script?




How to Open Any Website in Android Application in Android Studio

I just started a new appliction using android studio .. but i need to open a web page in my application i tried using web view but it doesnt worked out... when i open my app it crashes down

<WebView
    android:id="@+id/web_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

and i included in java class file

private  WebView wb;


@Override
protected void onCreate(Bundle savedInstanceState) {

 wb=(WebView)findViewById(R.id.web_view);
    WebSettings webSettings=wb.getSettings();
    webSettings.setJavaScriptEnabled(true);
    wb.loadUrl("http://ift.tt/Rvp0MX");

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_references);
}

In manifest xml file i included

<uses-permission android:name="android.permission.INTERNET"/>

but still my app crashes pllzz help me

android #android-studio




how can i get the size of a soft kayboard working with javascript and jquery?

I have a big problem with this, I have been working with a bewsite that contains an iframe, I had no problems until i tried to test it into my mobile phone.

I have 1 iframe with 3 divs, all of them with position relative (if i change it they go out of my mobile). 1 of them has an input, and when i click on it, the soft keyboard appears. My screen does not resize, so I only am able to watch 1 of the 3 divs. I have been reading about this, and i have a solution that i do not know how to programme.

Here: Get viewport height when soft keyboard is on

I found this: This solution is a bit convoluted, but it might work...

Detect whether or not the keyboard is active. Grab the viewport width/height Subtract the height of the keyboard.

I know when the keyboard is active, because is when i click on the input, but i am not able to get the size of the soft keyboard.

If someone could help me I would greatly appreciate it.

(it is my first time writing here, so if you need more information just let me know)




How to make pdf using mpdf that have big data in codeigniter?

I have some problems were using mpdf with a large data.

I'm using Codeigniter as backend framework and the database is SQL Server

I have set the memory limit to -1 =====> ini_set('memory_limit', -1); It works when I have a small data, e.g. 100 rows.

But, now I have 1000 rows and I got this error

Fatal error: Out of memory (allocated 823394304) (tried to allocate 230352 bytes) in C:\xampp\htdocs\simas\application\third_party\mpdf\mpdf.php on line 14487

what's wrong with my code? or how to fix this mpdf?

queries in model :

SELECT t.tgl_buku as tglbuku, t.kd_brg as kdbarang, b.namabarang, t.no_aset as qty, t.jns_trn, t.rph_aset as jumlah,t.asal_perlh as asal, t.merk_type as merk, t.keterangan, t.no_bukti as nobukti FROM as_transaksi t join ms_barang b on t.kd_brg = b.kdbarang WHERE t.jns_trn like '1%' and year(t.tgl_buku) = '2013' and month(t.tgl_buku) <= 6

table in view :

<table width="100%">
            <thead>
                <tr style="background:#C0C0FF; text-align:center;">
                    <center>
                    <td>Tgl Buku</td>
                    <td>Kd Barang</td>
                    <td>Nama Barang</td>
                    <td>Qty</td>
                    <td>Nilai</td>
                    <td>Supplier</td>
                    <td>Merk</td>
                    <td>Keterangan</td>
                    </center>
                </tr>
            </thead>
            <?php
            if (!empty($isdata)) {
                $total=0;
                foreach ($isdata as $row) {
                    $total=$total+($row->jumlah*$row->qty);
                    echo "<tr>";
                    echo "<td>". date('d-m-Y',strtotime($row->tglbuku))."</div></td>";
                    echo "<td>".$row->kdbarang."</div></td>";
                    echo '<td>'.$row->namabarang."</td>";
                    echo "<td>".$row->qty."</div></td>";
                    echo "<td>".$row->jumlah."</div></td>";
                    echo '<td>'.$row->asal."</td>";
                    echo '<td>'.$row->merk."</td>";
                    echo '<td>'.$row->keterangan."</td>";
                    echo '</tr>';
                }
            }else{
                echo "<tr>";
                echo "<td></td>";
                echo "<td></td>";
                echo "<td></td>";
                echo "<td></td>";
                echo "<td></td>";
                echo "<td></td>";
                echo "<td></td>";
                echo "<td></td>";
                echo "</tr>";
            }
            ?>
            <tr>
                <td></td>
                <td colspan="3">Total</td>
                <td><div align="right"><b><?=convertrp($total);?></b></div></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </table>

Please someone help me :)




Rust read_to_end function in the read trait ignores whitespace when reading markdown

My function is as follows:

fn read_file () -> String {
  let mut file = File::open("./assets/postdata/lorem_ipsum.md").unwrap();
  let mut buffer = Vec::new();
  let read_variable = file.read_to_end(&mut buffer).unwrap();
  let filestr = String::from_utf8(buffer).unwrap();

  return filestr;
}

The file is a markdown file with four paragraphs of lorem ipsum text. This function, when called by a handlebars record generator, prints to a webpage producing a wall of text. I'm obviously missing something, how can I make the Rust compiler recognise the whitespace. Can anyone help?