The Way to Programming
The Way to Programming
There is probably an error with your query.
I guess it is because you don’t quote the text values you supply to the query.
For example, the insert should be something like:
mysqli_query($con,"INSERT INTO mxit (ip,time,user_agent,contact,userid,id,login,nick,location,profile) VALUES ('".$ip."','".$post_time."','".$mxitua."','".$mxitcont."','".$mxituid."','".$mxitid."','".$mxitlogin."','".$mxitnick."','".$mxitloc."','".$mxitprof."')");
Right after opening the connection to the db, you close it at line: 11
So you can’t use it anymore. Remove the line 11:
mysqli_close($con);
I had to create method that obtained the [Max, Min] Points. I feel that the logic to my problem IS my problem. hope that makes sense. Ha
Well, I had several methods that obtain the [Max, Min] of both [X,Y]
public double getMax(BunchOfObjectspoints){ double maxX = points.getAll().get(0).getX(); for( Point p : points.getAll()){ if(p.getX() > maxX){ maxX = p.getX(); } } return maxX; }
Now, I need a Scale method that is going to work around these points
Can any help me with this method?
public double scale(BunchOfObjectspoints , double x, double y){ double maxX = getMax(points); double maxY = getMaxY(points); double minX = getMinX(points); double minY = getMinY(points); double dx = maxX - minX; double dy = maxY -minY; double scaledx = (x-minX)/dx; double scaledy = (y-minY)/dy;
Now, my question is…What do I return? Sorry, this problem is giving me headaches. and I can’t figure out exactly.
Why not do it using PhoneGap (or Apache Cordova on which PhoneGap is based)?
You create your app using HTML and CSS and JavaScript, and you can access all the features of the device too, e.g. camera, GPS, etc. That’s about as easy as it can be!
Firebug is one option. Here is a “how-to” article.
http://www.ehow.com/how_2315717_use-firefox-html-editor.html
How did you do that so quick, I need some help to understand the concept of normalization. Do you have any suggestions? I’ve watched videos on YouTube and seemed to get it but then when I try a new problem I have a hard time creating separate tables.
Also when you’re talking about unique key do you mean primary key?
This is what I figured would be primary keys:
Registered user table: UserID(PK)
Books table: BookID(PK)
Bidding Table: BookID(PK) — not sure about the other columns, how would you grab data from Registered user table without a relationship in any of the columns?
I assume you already have something that isn’t working. Maybe if you shared where you are …
Assuming you are using Apple’s MapKit, this should server your purpose.
- (void)viewDidLoad { UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(foundTap:)]; tapRecognizer.numberOfTapsRequired = 1; tapRecognizer.numberOfTouchesRequired = 1; [self.myMapView addGestureRecognizer:tapRecognizer]; } -(IBAction)foundTap:(UITapGestureRecognizer *)recognizer { CGPoint point = [recognizer locationInView:self.myMapView]; CLLocationCoordinate2D tapPoint = [self.myMapView convertPoint:point toCoordinateFromView:self.view]; MKPointAnnotation *point1 = [[MKPointAnnotation alloc] init]; point1.coordinate = tapPoint; [self.myMapView addAnnotation:point1]; }
The only way to do this program is give temporary write permission to the file and after having inserted the text you remove that permission. There is no other way around, if you don’t give the file the permission without an exploit you can’t write to it. You have plenty of choice to write to a file, I suggest you to use the Fopen and Fwrite of the C standard library or you can use other software in corelinux. To change permissions you use the chmod function that have this syntax
int chmod (const char *filename, mode_t permissions)
where permissions is in the i=0000 octal form. Check sys/stat.h for the available combination
Link:
http://code.google.com/p/libbmp/
DESCRIPTION:
libbmp is a simple, cross-platform, open source (revised LGPL) C library designed for easily reading, writing, and modifying Windows bitmap (BMP) image files. The library is oriented towards the novice programmer with little formal experience, but it is sufficiently capable for anybody who desires to do I/O and pixel operations on uncompressed 1, 4, 8, 16, 24, and 32 bpp (bits per pixel) BMP files.
libbmp is intended to be cross-platform on both little-endian (e.g., x86, x86-64) and big-endian (e.g., IBM PowerPC, Sun Sparc) architectures. So far, it has been tested on x86 with Linux (2.6.x kernels and gcc and MinGW/gcc) and Windows (XP Pro with msvc6).
About BMP file format, please see also http://en.wikipedia.org/wiki/BMP_file_format
.
EXAMPLE:
#include#include int main(int argc, char **argv) { bmpfile_t *bmp; int i, j; rgb_pixel_t pixel = {128, 64, 0, 0}; if (argc < 5) { printf("Usage: %s filename width height depth.\n", argv[0]); return 1; } if ((bmp = bmp_create(atoi(argv[2]), atoi(argv[3]), atoi(argv[4]))) == NULL) { printf("Invalid depth value: %s.\n", argv[4]); return 1; } for (i = 10, j = 10; j < atoi(argv[3]); ++i, ++j) { bmp_set_pixel(bmp, i, j, pixel); pixel.red++; pixel.green++; pixel.blue++; bmp_set_pixel(bmp, i + 1, j, pixel); bmp_set_pixel(bmp, i, j + 1, pixel); } bmp_save(bmp, argv[1]); bmp_destroy(bmp); return 0; }
Allright, as someone who has studied Java. I feel the language itself isnt terrible as much as I hate the general IDE built for Java. Cant really compare eclipse and IntelliJ to Visual Studio (my fav for C#). Anyways. I recommend the following for any starters out there and no investment required. Not even a single sign up. This dude is awesome. He starts from scratch, straight from downloading JDK to running your first app and explaining the difference and meaning of each action including getting used to the terminology which is the most important part.
https://www.youtube.com/playlist?list=PL484D73FA74A11AC9
Having said that. You will hate Java unless you plan on making a Android App. General desktop apps are painful to make in Java. But if you ever conquer it, you will conquer OOP in general. Good luck and have fun with it.
Here is a simple sample using a DataGridView that you can paste into a new Windows form and load. The controls are dynamic. You should be able to modify it to fit your needs. You can also query the database directly using Linq to SQL. You could present the user with the full lookup from the database and use that as the original source and then a second query using the text box text variable to pull the filtered list.
This text box text searches name, directory, and genre at the same time. Partial matches will work and it ignores case (same as with SQL Like).
public partial class Movies : Form { private TextBox textBoxSearch; private Listmovies; private List filtered; private DataGridView dataGridMovies; private Button buttonSearch; public Movies() { InitializeComponent(); textBoxSearch = new TextBox(); movies = new List (); filtered = new List (); dataGridMovies = new DataGridView(); buttonSearch = new Button(); this.AutoSize = true; InitializeControls(); InitializeMovies(); } private void InitializeControls() { textBoxSearch.Location = new Point(15, 15); buttonSearch.Location = new Point(textBoxSearch.Width + 30, 15); buttonSearch.Text = "Search By Movie, Director, or Genre"; buttonSearch.AutoSize = true; this.buttonSearch.Click += new System.EventHandler(this.buttonSearch_Click); dataGridMovies.Bounds = new Rectangle(new Point(15, textBoxSearch.Location.Y + 30), new Size(400, 200)); dataGridMovies.DataSource = movies; this.Controls.Add(textBoxSearch); this.Controls.Add(dataGridMovies); this.Controls.Add(buttonSearch); } private void InitializeMovies() { movies.Add(new Movie { name = "Star Wars", genre = "Sci-Fi", year = "1977", director = "George Lucas" }); movies.Add(new Movie { name = "The Matrix", genre = "Action", year = "1999", director = "Wachowski Brothers" }); movies.Add(new Movie { name = "The Dark Knight", genre = "Comic Book", year = "2008", director = "Christopher Nolan" }); movies.Add(new Movie { name = "The Hangover", genre = "Comedy", year = "2009", director = "Todd Phillips" }); } private void buttonSearch_Click(Object sender, EventArgs e) { string search = textBoxSearch.Text; filtered = movies.FindAll(m => m.name.IndexOf(search, System.StringComparison.OrdinalIgnoreCase) >= 0 || m.director.IndexOf(search, System.StringComparison.OrdinalIgnoreCase) >= 0 || m.genre.IndexOf(search, System.StringComparison.OrdinalIgnoreCase) >= 0); dataGridMovies.DataSource = filtered; } } public class Movie { public string director { get; set; } public string name { get; set; } public string genre { get; set; } public string year { get; set; } }
"; } else { echo "something went wrong
"; } } } closedir($dh); } } ?>
Didn’t include the php zip functionality … anyways, ftp and http on the same server or a different server?
the question is not about the parsing, that is not an issue as I’m using prepared statements.
The problem is rather the “visual” aspect :
a user enter’s some text that contains a single or double quote , this is being updated in the db as \” or \’ and then returned as the same value on the website : \” or \’ which looks stupid …
I would ideally want those chars to display in their natural form without the escape…
I have already played around with str_replace and var.replace , say ot replace all ” or ‘ to something like [single] or [double] and insert this into the db as a placeholder and once retrieved the replace goes the other way around.
Unfortunately , for some reason, even if I do the replace BEFORE the insert command, the characters are still being escaped.
Multidimensional Arrays
https://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx
FYI a multidimensional array is probably not the best approach for this
Try using a class which contains a List
E.G.
Create a Category and Item class
Category class contains a List of Items
List
https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx
Dictionary is also worth looking at:
https://msdn.microsoft.com/en-us/library/xfhwa508(v=vs.110).aspx
Sign in to your account