ajax dynamic object (associative array-like) into two MySQL tables via PDO
I have a js dynamic object that I "stringified" via
JSON.stringify(obj_to_str);
I'm able to receive this object in a php file under the super-global
$_POST. The object's format (once in the $_POST super-global) looks like
this:
{"6869lx":"mds","2416ex":"mdr","5126mv":"mdf","7079px":"dtr","5350ds":"dts"}.
I'd like to be able to insert each key-value pare into a different table
-for instance: 6869lx into a table called 'key', and on the same row on a
different table called 'cat', mds.
The problem I'm having is to prepare a dynamic PDO statement to insert
this js object into two different MySQL tables (considering the fact that
I do not know the length of the object before-hand). I also read that if
the object is very large a for loop (or any type of php loop) would slow
down the insertion process.
What would be the best way of doing this? Thanks much in advance.
Monday, 2 September 2013
How to solve this custom order with .htaccess?
How to solve this custom order with .htaccess?
On my site my pages are loaded by:
mysite.com/?module=42
and on my previous server it had a permalink structure like:
mysite.com/pages/EN/42/page_title
where "pages" is static everywhere but others vary after it.
And I would like to recover this functionality with .htaccess...
On my site my pages are loaded by:
mysite.com/?module=42
and on my previous server it had a permalink structure like:
mysite.com/pages/EN/42/page_title
where "pages" is static everywhere but others vary after it.
And I would like to recover this functionality with .htaccess...
Import MySQL data from xampp
Import MySQL data from xampp
I have created a MySQL-database for a website in xampp. Today got my new
server which is running ubuntu. Everything is installed and working fine.
I want to move database which I created in xampp and move it to my server,
can someone tell me how to do this? The database is created with
phpmyadmin.
Best regards! Emil
I have created a MySQL-database for a website in xampp. Today got my new
server which is running ubuntu. Everything is installed and working fine.
I want to move database which I created in xampp and move it to my server,
can someone tell me how to do this? The database is created with
phpmyadmin.
Best regards! Emil
Compatibility issues when installing MS JVM on Win 7
Compatibility issues when installing MS JVM on Win 7
I am trying to install MS JVM on Windows 7. However, it will pop up a
dialog (shown in the screenshot) about compatibility issues. I have
followed the instruction here (http://support.microsoft.com/kb/304930) to
try to install the MS JVM with silent mode , but the dialog will still
display. Is there any way to skip the compatibility dialog?
I am trying to install MS JVM on Windows 7. However, it will pop up a
dialog (shown in the screenshot) about compatibility issues. I have
followed the instruction here (http://support.microsoft.com/kb/304930) to
try to install the MS JVM with silent mode , but the dialog will still
display. Is there any way to skip the compatibility dialog?
Sunday, 1 September 2013
java collection usage as map and retrieving data
java collection usage as map and retrieving data
Map<String, List<OfferBean>> map = new HashMap<String, List<OfferBean>>();
List<OfferBean> al=new ArrayList<OfferBean>();
OfferBean of=null;
sql="select * from catgory";
ps1=c.prepareStatement(sql);
ps1.execute();
rs=ps1.getResultSet();
if(rs.next())
{
System.out.println("inside loop of if");
sql="select * from catgory";
ps1=c.prepareStatement(sql);
ps1.execute();
rs=ps1.getResultSet();
while(rs.next())
{
of=new OfferBean();
System.out.println("inside loop of while");
of.setCategory(rs.getString("catgoryname"));
al.add(of);
}
map.put("key", al);
i want use two array list the both array list i will put inside map by
using key and i want to pass to the jsp side in the jsp side i want
retrieve the data using jstl how to reteive it plz any one help me
Map<String, List<OfferBean>> map = new HashMap<String, List<OfferBean>>();
List<OfferBean> al=new ArrayList<OfferBean>();
OfferBean of=null;
sql="select * from catgory";
ps1=c.prepareStatement(sql);
ps1.execute();
rs=ps1.getResultSet();
if(rs.next())
{
System.out.println("inside loop of if");
sql="select * from catgory";
ps1=c.prepareStatement(sql);
ps1.execute();
rs=ps1.getResultSet();
while(rs.next())
{
of=new OfferBean();
System.out.println("inside loop of while");
of.setCategory(rs.getString("catgoryname"));
al.add(of);
}
map.put("key", al);
i want use two array list the both array list i will put inside map by
using key and i want to pass to the jsp side in the jsp side i want
retrieve the data using jstl how to reteive it plz any one help me
Postcode and Country Match with Javascript
Postcode and Country Match with Javascript
i have some difficulties to get a regex running for this cases - sorry i´m
very new to regex and can´t figure it out.
the pattern look like this
12 (true)
123 (true)
1234 (true)
12345 (true)
123 münchen (false)
12345 münchen (true)
12345 mün (true)
münchen 123 (false)
mün 12345 (true)
so if combined with letters, postcode has to fullfill the max lenth given
in the range like {2,5}
I tried with this one, but is doesn´t work like i need it
/^([0-9]{2,5})(\s+[^a-zA-Z]{2,})?$/
can somebody help me out thx in advanced
i have some difficulties to get a regex running for this cases - sorry i´m
very new to regex and can´t figure it out.
the pattern look like this
12 (true)
123 (true)
1234 (true)
12345 (true)
123 münchen (false)
12345 münchen (true)
12345 mün (true)
münchen 123 (false)
mün 12345 (true)
so if combined with letters, postcode has to fullfill the max lenth given
in the range like {2,5}
I tried with this one, but is doesn´t work like i need it
/^([0-9]{2,5})(\s+[^a-zA-Z]{2,})?$/
can somebody help me out thx in advanced
Invoke-WebRequest working after server is unreachable
Invoke-WebRequest working after server is unreachable
I am using Invoke-WebRequest in a SCOM PowerShell script to periodically
monitor the availability of a URI. My script is fairly simple (since I
have very little knowledge of PS :-) ):
$scomapi = new-object -comObject "MOM.ScriptAPI"
$scompb = $scomapi.CreatePropertyBag()
$fullHostName = "https://" + <full path to monitored web endpoint>
$result = Invoke-WebRequest $fullHostName
if($result.content) {
$scompb.AddValue("ConfigurationReachable",$true);
} else {
$scompb.AddValue("ConfigurationReachable",$false);
}
$scomapi.AddItem($scompb)
$scomapi.ReturnItems()
In order to test this script, I did manual changes in the hosts file on
the client running the SCOM agent where I want to do the monitoring.
Interestingly, the script succeeds in fetching the web endpoint even after
the host is unreachable (tested this by pinging from that machine).
I did some further tests directly from the command line, and nothing
changes. Even though I have no ping to the remote address,
Invoke-WebRequest still succeeds and fetches the web page. So what am I
doing wrong here?
I am using Invoke-WebRequest in a SCOM PowerShell script to periodically
monitor the availability of a URI. My script is fairly simple (since I
have very little knowledge of PS :-) ):
$scomapi = new-object -comObject "MOM.ScriptAPI"
$scompb = $scomapi.CreatePropertyBag()
$fullHostName = "https://" + <full path to monitored web endpoint>
$result = Invoke-WebRequest $fullHostName
if($result.content) {
$scompb.AddValue("ConfigurationReachable",$true);
} else {
$scompb.AddValue("ConfigurationReachable",$false);
}
$scomapi.AddItem($scompb)
$scomapi.ReturnItems()
In order to test this script, I did manual changes in the hosts file on
the client running the SCOM agent where I want to do the monitoring.
Interestingly, the script succeeds in fetching the web endpoint even after
the host is unreachable (tested this by pinging from that machine).
I did some further tests directly from the command line, and nothing
changes. Even though I have no ping to the remote address,
Invoke-WebRequest still succeeds and fetches the web page. So what am I
doing wrong here?
Subscribe to:
Posts (Atom)