Passing value with out using variable in query string in PHP! - General Topics

Hi all here at forum.
I am working to find out some solution to access a web page in PHP that is showing information on the bases of given argument in query string variable. My problem is this that I want to get the value of variable in query string but I don’t want to show the variable name and also want to hide the page name like below urls are opening fine.
globalguideline.com/JavaScript_Guide/JavaScript_Examples.php?JScript=first_JavaScript
globalguideline.com/JavaScript_Guide/JavaScript_Examples.php?JScript=JavaScript_HelloWorld
globalguideline.com/JavaScript_Guide/JavaScript_Examples.php?JScript=HTML_With_JavaScript
But I want to open the same pages as below urls instead of above all.
globalguideline.com/JavaScript_Guide/first_JavaScript
globalguideline.com/JavaScript_Guide/JavaScript_HelloWorld
globalguideline.com/JavaScript_Guide/HTML_With_JavaScript
Is it possible in PHP if yes then please help me to get out from this problem.
Regards,
Ali.

You could use sessions, cookies or a POST to do that quite easily. Or are you trying to access the php page from a windows mobile application?

If you dont want to see the variable data in the string (aka GET) then use the POST method instead.

Related

Writing app, having trouble

Hey guys, I know this thread is probably better suited for the development thread, but I am not allowed to post there, so here goes:
I am working on improving the notepad app that is created through the notepad tutorial provided for android development, and at the moment I am trying to make a preferences page that allows me to enter a number, hit confirm, and the app will use that number to change the font. My approach so far has been to pass a startActivityForResult call, which returns a number, then in my onActivityResult I check for that number which should be returned. I then capture the result code, which should not be an integer, it has been parsed in the methods that were called. All that seems to be running fine, but when I try to use TextView to setTextSize my application is force closing, I have tried a few different ways of implementing this setTextSize method, including not using the variable that I am getting back (resultCode) at all, and instead just plugging in a preset number, but the application is still bombing as soon as I try to call setTextSize in any way. I wanted to see if there is anything special about the setTextSize that I may be missing, or if there is a better way of setting font size at run-time.
Thanks,
Nate
Does this help at all?
I did find that post through my searching, and even calling the setTextSize using pixels it still bombs out, here is my code for making the text larger:
fontSize = resultCode;
TextView tv;
tv = (TextView)findViewById(R.id.text1);
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
I do not know if this matters or not, but the view that is being used is notes_row which is referenced by id text1, more importantly, notes_row is used to display the rows on the notes_list view.
Thanks for the help, I am new to android programming, and this is something I have had trouble with for the past 2 days.
OK well what does the stack trace look like? what errors are you getting? and i know you said you plugged in an actual number in place of the variable (just for testing), but how did you plug that number in? did you just use the number or did you use the Float or Integer object or what?
Unfortunately, I do not know what a stack trace is, if you could elaborate I would be very grateful.
When I plugged the number in directly I did it both by creating a variable of type float and assigning it a value, and using that variable in the method call, as well as just putting a number directly into the method call.
Bump. Can't figure out why a simple textview.settextsize would cause a force quit.
Sitrep: I figured out the problem with my code, but in the process caused another problem. Here is the deal, I was instantiating TextView with a view object, rather than a context, after switching the line that said TextView tv = new TextView( (TextView) findViewById(R.id.text1))) to TextView tv = new TextView(this). The problem with that is, I am trying to edit data that is in a pre-existing textview, declared in one of my xmls, and therefore creating a new one does not seem like the right way to be going, or maybe I just do not understand the way to do it.
Does anyone know a way for me to access my pre-existing TextView (created in my xml file) at run-time, or even a way to apply settings that I change on my new TextView to my pre-existing one. Is this possible or do I need to be looking for a different solution (someone suggested that I create a separate view for each text size that I want to create, and then once a user selects the text they want using a menu, just call the appropriate view) I would prefer to use a more elegant solution if possible.
Thanks for all the help so far,
Nate
Doing more reading, I see that I do in fact need to make my TextView = the one that is currently defined with the program, the problem with this is that when I put breakpoints right after where I declare this statement: TextView tv = (TextView) findViewById(R.id.text1); Under variables tv shows as a null, and I believe that is the reason that I getting the crash, I think the program is seeing null.setText...... instead of view.set....
To the top

[Q] web app

Hello,
I dont know if the title fits, so i gonna explain my Problem.
I want to Programm a Game With User Login. Sadly wp7 doesnt Support SQL api, so i cant make the User Management directly over sql.
So i got a Website with a working Login Formular. I want to link the wp7 textboxes with the textboxes of the Website which works with SQL.
Is there a simple way to get this working? Or does anyone have a better idea to get my User Management working?
Greatings win99
Sent from my HD2 using Board Express
Hmm... I can only suggest you to learn how to do http requests (and general programming of course). I hope u'll stop thinking in terms like "linking textboxes"
yeah, "linking" is maybe the wrong word
What exactly do you mean with "http request"?
I can program a bit html an php, which i could include in a "WebBrowser" control. This way i could use php with mysql, but i don't want to make a browser game.
Is there somethink like a "http database"? Cause i don't know yet any database based on http. And is there an API availible to do this requests from a panorama app?
Sorry for this basicly questions, but i'm just a hobby programmer and since now i just programme windows desktop projects, where i could easily use SQL.
Your "very basic question" requires a very long answer (sorry, but I don't have enough time. Also, I'm not an expert in SQL http communication). FYI, all communications between web page (and you can treat your WP7 page as a web page) and SQL server based on HTTP POST requests (but of course not on "linked textboxes"! ). So, try to google with words such as "WP7 SQL HTTP POST" - first five links possible will have all info you need (but you should understand "how everything works" first!)
ok, if i understand it correctly, this sound like instead of using "app<->SQL" i should use "appy<->http<->sql".
i will try to find some good tutorials and reply on success/ no success.
win98 said:
ok, if i understand it correctly, this sound like instead of using "app<->SQL" i should use "appy<->http<->sql".
i will try to find some good tutorials and reply on success/ no success.
Click to expand...
Click to collapse
Well, from the sounds of it, I am going to assume you networking and web API knowledge and maybe decent enough MySQL/SQL/Database knowledge, and possibly somewhat new to WP7 C#.NET (Don't take this personal or a lashing towards you, not the case, I mention it so I can be basic and to the point without assuming you know what references I make or offend you).
If you want an "out-of-the-box" easy solution, let's stop and go download RestSharp (http://restsharp.org). After you get it, visit: https://github.com/restsharp/RestSharp/wiki/Getting-Started, as this will give you a great example of HOWTO use this solution.
You also need to remember about the footprint, a 90MB limit (Max) on 256MB phones. Too big can cause some issues.
Also, another good option is SQLlite, probably one of the most popular, straight forward and well respected (I even use it on some projects). Should you choose to use it, go to http://sviluppomobile.blogspot.com/2010/07/wp7-sqliteclient-preview.html and read his Blog post, VERY informative and a Sample available for you to learn from as well.
If you really wanted to do this yourself, you could create an HTML page and do all your coding in it (e.g. Login Box) and use JavaScript as well, this way you grab the contents from your textbox(s) and send to the embedded web browser you load the HTML page in, hence scripting is available for WP7 but must enable scripting support and highly recommend to use IsolatedStorage and can invoke JS just as easy as:
window.external.notify("(Task)Param)");
So this should hopefully get you to where you want to be but if any of the above statement I made was true, I recommend out-of-the-box solutions for you.
Thanks,
Lance
lseidman said:
If you really wanted to do this yourself, you could create an HTML page and do all your coding in it (e.g. Login Box) and use JavaScript as well, this way you grab the contents from your textbox(s) and send to the embedded web browser you load the HTML page in, hence scripting is available for WP7 but must enable scripting support and highly recommend to use IsolatedStorage and can invoke JS just as easy as:
window.external.notify("(Task)Param)");
Click to expand...
Click to collapse
This is the way i planned to do it. How do you call it? For me it is hard to find a tutorial or book or something like that, cause i don't know which keyword to google
thanks anyway
win98 said:
This is the way i planned to do it. How do you call it? For me it is hard to find a tutorial or book or something like that, cause i don't know which keyword to google
thanks anyway
Click to expand...
Click to collapse
First and foremost, I appreciate your honesty which is why I will basically show you the way...
Well, if you wish to invoke JavaScript via WP7 you can, like below:
1). Open your Mainpage.xaml and find the grid and insert:
<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser1" VerticalAlignment="Top" Height="xxx" Width="xxx" IsScriptEnabled="True" ScriptNotify="webBrowser_callback" />
2). Make an HTML page, go in the HEADER section and type something like: "<SCRIPT LANGUAGE="JavaScript" src="HelloWorld.js"></SCRIPT>" and add a button that has a function to fire upon clicking + name the section like:
<h1 id='myName'>Hello World!</h1>
<form>
<input id="button" type="button" class="button-standard" style="width:200;height:100" value="Hello World!" onClick="HelloWorld()"/>
* Remove the Quotes from above...
3). Make a file called HelloWorld.js and put in something like:
function HelloWorld() {
window.external.Notify("Name");
}
function sets(val) {
document.getElementById('myName').innerHTML = val;
}
4). In your Mainpage.xaml.cs, find where you want to invoke the script/site and put in:
webBrowser1.Navigate(new Uri("http://lance.compulsivetech.biz/login", UriKind.Relative));
*Change the URI to your address, not my blog's fake login...
5). Since we are loading the site locally in Isolated Storage, go forth and type this in:
private void CreateDirOnStore(string strDir)
{
// Create a directory for local storeage.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoStore.DirectoryExists(strDir))
isoStore.CreateDirectory(strDir);
}
private void SaveFileToIsoStore(string strFileName)
{
// This will save the file to the isolated storage based on the string provided.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
//remove the file if exists to allow each run to independently write to
// the Isolated Storage
if (isoStore.FileExists(strFileName) == true)
{
isoStore.DeleteFile(strFileName);
}
StreamResourceInfo sr = Application.GetResourceStream(new Uri(strFileName, UriKind.Relative));
using (BinaryReader br = new BinaryReader(sr.Stream))
{
byte[] data = br.ReadBytes((int)sr.Stream.Length);
//save file to Isolated Storage
using (BinaryWriter bw = new BinaryWriter(isoStore.CreateFile(strFileName)))
{
bw.Write(data);
bw.Close();
}
}
}
6). In your public MainPage() put:
this.Loaded += new RoutedEventHandler(Load_WebPage);
* Always put stuff after your Intialize call
7). We need to make a page load function as below (in xaml.cs):
void Load_WebPage(object sender, RoutedEventArgs e)
{
//Set the start folder of the widget and navigate to the start page
CreateDirOnStore("helloworld");
SaveFileToIsoStore("helloworld/index.html");
SaveFileToIsoStore("helloworld/helloworld.js");
webBrowser1.Base = "helloworld";
webBrowser1.Navigate(new Uri("index.html", UriKind.Relative));
}
8). Now we invoke the function as seen below:
void webBrowser_callback(object sender, NotifyEventArgs e)
{
//Use invokeScript to give to the web env.
webBrowser1.InvokeScript("eval", new string[] { "sets('txtName.Text')"});
}
Hope this helps, this is basically off the top of my head but should be pretty close to being right and Mango Compat.
Creating a WCF services that calls SQL will be the quickest way...about 30 minutes.

[Q] Comparing two times

Hi,
I'm now developing an Rubik cube timer, and there is an problem, and that is how to compare two times, becouse I'm looking for top time, so if second time is better than first time, program display second time. Problem is that time is saved as String, becouse in silverlight code:
Code:
<TextBlock FontFamily="Verdana" FontSize="30" FontStretch="Normal" Height="37" Margin="262,192,146,0" Name="bestMin" Text="00" VerticalAlignment="Top" Foreground="Wheat" />
is bestMin saved as String and it has value 00, and i dont know how to compare two Strings.
I know that this question must be under developing forum, but i cant post in developers forum becouse im new.
P.S. Sorry, but my english is bad
If you're storing the time as a numeric field (rather than as a datetime string) you can simply parse the integer back out of the string (I believe the int.TryParse() function is what you want here) and then compare that to the other integer that you already have.
Does this answer your question? It *is* also possible to compare Strings directly, but I don't recommend doing so here - you get weird behavior like "1000000" < "9"
Thanks that was very helpfull, now i need to find out average of 10 times, how can i do that.
To the first question:
.Net features a timespan class - use it for all calculations! That's what it's for. How do you store the time? Take a look at the IsolatedStorageSettings to save a setting - just pass the timespan and you'll get it right as timespan back - without the need to convert anything...
Second question:
You can simply sum up all timespans and divide them by the number of timespans or simply use the average function...
e.g.
Code:
List<TimeSpan> spans = new List<TimeSpan>();
TimeSpan average = TimeSpan.FromSeconds(spans.Average(ts => ts.TotalSeconds));
Visibility change
How to change visibility of an object (textblock, listbox, ...) in c#
Code:
myControl.Visibility = System.Windows.Visibility.Collapsed;
P.S. I believe you should read C#/SL book or google first for that kind of very basic questions instead of asking xda gurus
sensboston said:
P.S. I believe you should read C#/SL book or google first for that kind of very basic questions instead of asking xda gurus
Click to expand...
Click to collapse
Would be like asking to God for a BigMac. However check online for a C# book.
I recommend C# 4.0 by O'Reilly.

How add a toggle button for active inactive in Yii CgridView

By the help of FPDI library, I tried to write some exsiting pdf files but able to wirte only single page of pdf.
Below is my code:
PHP:
require_once '../includes/fpdf/fpdf.php';
require_once '../includes/fpdf/fpdi.php';
$pdf = new FPDI();
$pageCount = $pdf->setSourceFile("contractFinalTrans.pdf");
$tplIdx = $pdf->importPage(1);
$pdf->addPage();
$pdf->useTemplate($tplIdx, 10, 10, 200);
//set position in pdf document
// now write some text above the imported page
//$pdf->SetFont('Arial');
$pdf->SetFontSize(10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(50, 50);
$pdf->Write(0, "page 1");///print this output
$pdf->SetAutoPageBreak(true,22);
$pdf->addPage();
$tplIdx = $pdf->importPage(2);
//$pdf->addPage();
$pdf->useTemplate($tplIdx, 10, 10, 200);
//set position in pdf document
// now write some text above the imported page
//$pdf->SetFont('Arial');
$pdf->SetFontSize(10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(100 , 100);
$pdf->Write(0, "page 2");
$pdf->Output();
Can anyone suggest me how to Edit Existing multiple pdf using fpdf Library in PHP
I have explored many php developer forum related to this issue but I am unable to get satisfactory solutions. Hope this forum help me out for the same issue.
How to connect MySQL database in Java ?
I am coding a module in java that need a database connection with MySQL. I heard about DriverManager but I think it is pretty old method for database connection. Is there any newer and efficient way of doing the same. This Java questions and answers forum comprises of large number of tech and coding expert, So I expect quick and satisfactory solution or full set of instruction/ code require for this.
Connect mysql Java, Java mysql connection, DB connection in Java
http://findnerd.com/askquestion/java
I am coding a module in java that need a database connection with MySQL. I heard about DriverManager but I think it is pretty old method for database connection. Is there any newer and efficient way of doing the same. This Java questions and answers forum comprises of large number of tech and coding expert, So I expect quick and satisfactory solution or full set of instruction/ code require for this.

Reading a URL

I am trying to make a self steering gear for a boat. The actuator side that moves the tiller uses an ESP8266 and rather than add a compass there along with push buttons and LCD I thought I would try to use an Android phone and send the data to the ESP over wifi.
My starting point is compass_dev from github. This gives me a variable called "azimuth" that is taken directly from the phone/tablet. I do not at this stage need to be concerned with any of the inner working about how azimuth is arrived at and can, for now, just take it as a correct value that I have to work on.
All good so far and working well. The ESP has a PID controller to know how to move the rudder and it accepts from a web page on the ESP, a number that is the angle between a locked heading and the bearing the boat is going on so any number between 180 and -180.
This number is transferred from the main compass application through a singleton into my http handling bit (dohttp). In dohttp I am connecting to my ESP with this:
protected Long doInBackground(URL... urls) {
try {
components = SingletonSession.Instance().getBearing();
URL url = new URL("http://192.168.0.57/msg?msg="+components);
// Log.e("bears", "H11 " + components);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setChunkedStreamingMode(0);
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
out.flush();
out.close();
connection.disconnect();
}
You can see that the URL is:
http://192.168.0.57/msg?msg="+components
components is normally just the error angle (azimuth - bearing)
If I enter, for example "12" then once this URL is accepted by the ESP the URL will change to:
http://192.168.0.57/msg?msg=12&EX=Execute
So you can see that if the ESP has received correctly I can parse the URL looking for:
12&EX=Execute
If I do not get this then the ESP has missed the value.
The problem I have is that I cannot work out how to read the URL. I do realise that I can add the values to the actual page and parse the data out with a read but it seems a long winded way when just reading the URL would give me what I need if reading the URL is possible.
I am a complete beginner and this is the first java programming I have ever attempted, first use of Android Studio and have really struggled to get this far so please make the answers as simple as possible.Any input is greatly appreciated.
Please excuse me if this is not in the right place, I seem not to have permission to put it where I think it should go and this is the closest I could find that was even slightly relevant.

Categories

Resources