My client have created a script in php+mysql that saves images directly in the database and every images has url like this: www.example.com/image.php?id=421
In your opinion this is a very wrong solution ? Should I rebuild all the site ?
There are about 1000 visits per day and about 600 images in the database.
This is the site: http://tinyurl.com/3xkxdsw
Hi all!
I'd like to ask for a solution. For example we have a page. And I have a link to a another action from this page. I want to have an ability to save the values of entered data on the page.
For instance I go to another page enter data and go back. Like the wizard. But the problem is that we can come to the action from different pages. And it need to save several data types.
Is it understand?
Any suggestions?
I'd like to have common solution....
I have a Class A that when it is instantiated and saved for the first time or modified it will create an instance of Class B and save it also
I want them to be in the same transaction and I want it to be handled in the Model not a controller.
I know how to do this in a conteoller with the ‘transaction do’ block but how do I do it in the model?
Thanks
I'm having a problem trying to save (update) some associated data. I've read about a million google returns, but nothing seems to be the solution. I'm at my wit's end and hope some kind soul here can help.
I'm using 1.3.0-RC4, my database is in InnoDB.
Course has many course_tees
CourseTee belongs to course
My controller function is pretty simple (I've made it as simple as possible):
if(!empty($this-data))
$this-Course-saveAll($this-data);
I've tried a lot of different variations of that $this-data['Course'], save($this-data), etc without luck.
It saves the Course info, but not the CourseTee stuff. I don't get an error message.
Since I don't know how many tees any given course will have, I generate the form inputs dynamically in a loop.
$form-input('CourseTee.'.$i.'.teeName', array('error' = false, 'label' = false, 'value'=$data['course_tees'][$i]['teeName']))
The course inputs are simpler:
$form-input('Course.hcp'.$j, array('error' = false, 'label' = false, 'class' = 'form_small_w', 'value'=$data['Course']['hcp'.$j]))
And this is how my data is formatted:
Array
(
[Course] = Array
(
[id] = 1028476
...
)
[CourseTee] = Array
(
[0] = Array
(
[key] = 636
[courseid] = 1028476
...
)
[1] = Array
(
[key] = 637
[courseid] = 1028476
...
)
...
)
)
I'm building an app to save data and some calculations made with those datas, the idea is keep the data in one model and the calculations in other. So, the models are like this:
class FreshData(models.Model):
name = models.CharField(max_length=20)
one = models.IntegerField()
two = models.IntegerField()
def save(self, *args, **kwargs):
Calculations()
Calculations.three = self.one + self.two
super(FreshData, self).save(*args, **kwargs)
Calculations.save()
class Calculations(FreshData):
three = models.IntegerField()
I've got a valueerror pointing out "self.one" and "self.two" as without value. I keep the idea in witch my design is wrong and django has a simpler way to store related data.
I guess this is a continuation of the last question I asked: http://stackoverflow.com/questions/2587542/bulk-insert-and-update-with-ado-net-entity-framework.
I am not getting any errors while doing inserts yet no data is actually going into my DB. My DB is a SDF file (SQL CE). Any ideas what to check?
My app.config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="Lab_Use_Billing.Properties.Settings.LabUseConnectionString"
connectionString="Data Source=|DataDirectory|\Models\LabUse.sdf"
providerName="Microsoft.SqlServerCe.Client.3.5" />
<add name="LabUseEntities"
connectionString="metadata=res://*/Models.LabUseEntities.csdl|res://*/Models.LabUseEntities.ssdl|res://*/Models.LabUseEntities.msl;
provider=System.Data.SqlServerCe.3.5;
provider connection string="Data Source=|DataDirectory|\Models\LabUse.sdf""
providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
TIA
I have an Activity with a list that is bound to a ListAdapter reading data into a ArrayList from a database. All is well when the data is first loaded. While the Activity is open and the list is being displayed it is possible and likely that the data in the database will be updated by a service but the list does not reflect the changes because the ArrayList does not know about the changes. If the Activity is no longer in the foreground as would be the case if the user goes to the home screen and then is brought back to the foreground I would like for the Activity to not display what it did prior but rather reload the data using the ListAdapter the view is bound to. I think something needs to call finish() but I am not sure what. This is what I have in the Activity.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setUpViews();
app = (MyApplication) getApplication();
adapter = new MyListAdapter(this, app.getMyEvents());
setListAdapter(adapter);
}
@Override
protected void onResume() {
super.onResume();
adapter.forceReload();
}
I want to write user selected settings in Metro app, in Local Folder. I have done the code as below, but it is not working.
The code to save settings:
void OnUnloaded(object sender, RoutedEventArgs args)
{
//code to save app settings.
var localSettings = ApplicationData.Current.LocalSettings;
localSettings.Values["playerPosition"] = playerPosition;
localSettings.Values["aiPosition"] = aiPosition;
localSettings.Values["selectedLevel"] = selectedLevel;
}
The code to read settings:
var localSettings = ApplicationData.Current.LocalSettings;
if ((localSettings.Values["playerPosition"]) == null)
{
localSettings.Values["playerPosition"] = 1;
localSettings.Values["aiPosition"] = 1;
localSettings.Values["selectedLevel"] = "1";
playerPosition = aiPosition = 1;
selectedLevel = "1";
}
else
{
playerPosition = (int)localSettings.Values["playerPosition"];
aiPosition = (int)localSettings.Values["aiPosition"];
selectedLevel = (string)localSettings.Values["selectedLevel"]; ----
Clearly I am supposed to save this localSettings variable in a file. But, I am unable to find the code to do that. Also, is Unload event a good place to do it, or should I move it to OnNavigatedFrom event?
select @[email protected]('*')
for xml raw,type
Above statement will generate following alert:
Msg 6819, Level 16, State 3, Line 2
The FOR XML clause is not allowed in a ASSIGNMENT statement.
I have a simple program where I would like to save an arraylist to a file, so that when the program is restarted, it loads from the file to the arraylist in memory.
Is this possible in C#? Or do I need to itterate over the arraylist countaining my custom classes and in someway print them out?
Any tips on a correct way to do this?
The answer to this may be obvious but how do you save an object, in grails, that has a composite id. I have an object that has a composite id including a long and a date and I am trying to save an instance of the object from the update method of another classes controller, and using (object).save() isn't working. Any tips or suggestions?
My application accepts file uploads, with some metadata being stored in the DB, and the file itself on the file system. I am trying to make the metadata visible in the application before the file upload and post-processing are finished, but because saves are transactional, I have had no success. I have tried the callbacks and calling create_or_update() instead of save(), all to no avail. Is there a way to do this without re-writing the guts of ActiveRecord::Base? I've even attempted naming the method make() instead of save(), but perplexingly that had no effect.
The code below "works" fine, but the database is not modified until everything else is finished.
def save(upload)
uploadFile = upload['datafile']
originalName = uploadFile.original_filename
self.fileType = File.extname(originalName)
create_or_update()
# write the file
File.open(self.filePath, "wb") { |f| f.write(uploadFile.read) }
begin
musicFile = TagLib::File.new(self.filePath())
self.id3Title = musicFile.title
self.id3Artist = musicFile.artist
self.id3Length = musicFile.length
rescue TagLib::BadFile => exc
logger.error("Failed to id track: \n #{exc}")
end
if(self.fileType == '.mp3')
convertToOGG();
end
create_or_update()
end
Any ideas would be quite welcome, thanks.
Hey,
I'm developing a web application that provide a service of online reservation, and I need to save the data (for example in a specific day and access to them).
How can I do that.
Is it possible using : System.Web.UI.WebControls.Calendar
Sometimes I noticed that a 'save:' operation an a ManagedObjectContext never returns and consumes 100% CPU.
I'm using an SQL Store in a GarbageCollected environment (Mac OS X 10.6.3). The disk activity shows about 700 KB/s writing. While having a look at the folder that contains the sqlite database file the "-journal" file appears and disappears, appears and disappears, ...
This is part of the call graph from the process analysis:
2203 -[NSManagedObjectContext save:]
1899 -[NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:]
1836 -[NSSQLCore executeRequest:withContext:]
1836 -[NSSQLCore saveChanges:]
1479 -[NSSQLCore performChanges]
...
335 -[NSSQLCore recordChangesInContext:]
...
20 -[NSSQLCore rollbackChanges]
...
2 -[NSSQLCore prepareForSave:]
...
62 -[NSPersistentStoreCoordinator(_NSInternalMethods) _checkRequestForStore:originalRequest:andOptimisticLocking:]
...
1 -[NSPersistentStore(_NSInternalMethods) _preflightCrossCheck]
...
184 -[NSMergePolicy resolveConflicts:]
...
120 -[NSManagedObjectContext(_NSInternalChangeProcessing) _prepareForPushChanges:]
...
Everything a happening in the main GUI thread.
Any ideas what I can to do to resolve the problem?
I've few excel sheets and i want to distribut them along with ap.
I want to create an application that open those excel sheets, allow user to modify the content and save the excel sheet as new file.
For that purpose, I think I can open excel sheets in UIWebView that allows editing as well.
But the trouble is, can I save edited Excel sheet in UIWebView back on to iPad?
If Possible, how?
I'm currently testing my Rails controllers using RSpec. In one controller, I have a model that uses transactions, so that it will not be saved unless another nested model (whose data is filled in using fields_for) is also saved correctly.
The tests hit a snag when they reach the transaction. Some debugging output proves that the model is valid and ready to save. However, upon entering the transaction block, the model does not save. Even stranger, the code never reaches the else clause of "if model.save" (It does, however, enter the transaction block).
I can only assume this is a problem with my testing a transactional model.
Any ideas/hints/solutions?
HI. I know this is simple question but when I use
FirstPersonTestImage.Save(IIdComboBox.Text + "-" + i + ".jpg");
it works and saves file to folder where is the .exe file . But I want to save it to specific folder like /photo/IO-66/ and tryed to use
String StudentPath = PhotoPath + IGroupNoComboBox.Text + "/" + IIdComboBox.Text + "/" + IIdComboBox.Text + "-" + i + ".jpg";
FirstPersonTestImage.Save(StudentPath);
BUt it gives
An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll
How can I solve this problem? Is is about folder path ? or using "/" ?
EDIT
Here My code for creating and checking existing or not folder
if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()))
{
Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim());
}
if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+ "/" + IIdComboBox.Text.ToString().Trim() + "/"))
{
Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+"/" + IIdComboBox.Text.ToString().Trim() + "/");
}
Using a TSQL update command against a SQLServer database, how can I update a column of type FLOAT with the smallest possible double value?
The smallest possible double value in hex notation being 3ff0 0000 0000 0001
(http://en.wikipedia.org/wiki/Double%5Fprecision)
Hi, to every one, i am doing xml parsing and i am getting two text files from the server with contents
i have stored the contents of the first file document directory however when parsing function call second time the contents are overwritten by second file, i don't know how to create two txt file in document directory for two different contents paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
documentsDirectory = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Report.txt"];
[text writeToFile:documentsDirectory atomically:NO];
[text release];
I HAVE TAKEN THE CONTENT FOR THE FIRST FILE WITH THIS METHOD.
I am a new-comer to OpenGL, and much of it remains mysterious to my feeble brain. I have been studying the NeHe demos as well as the Red Book. I am writing an Android application that displays the Earth in the center of the screen. The user can rotate the Earth about any axis (much like a very simple "Google Earth").
This code is working (I based it on the NeHe examples). Now I want to add a feature; the user should be able to save the current model orientation, then later return to that same orientation. For example, the user may save the Earth orientation such that the viewer is looking down at her hometown, and north-east is "up".
How do I do this with OpenGL-ES? To capture and save the current orientation, my code could get the current model-view transformation matrix - I think I understand how to do that. But later on how do I apply that saved matrix to restore the view?
hello all,
I have class named Shop that contain data members (NSString , NSInteger and nsmutablearray that contain another class(that have also NSString and NSInteger)
Now if i use nsmutablearray to hold alist of Shops what is the best way to save the list to file and load it later?
again the class Shop contain data memeber that is another class both of the classes have NSString and NSinteger (maybe also NSdata and NSdate)
i heard somthing about archiver??
thanks.
I heard that Windows 7 restricts access to its registry, so that applications cannot write directly to it. Is this so? I am developing an application in C#, and I would like to be able to save things such as port settings, last file used, etc. between sessions. Is the registry still a good option, or is there another preferred means of doing this now? Thanks.
Good day.
I know that in order to save object state in Java I should use serialization. But in every single topic about serialization states that I must save my object somewhere (disk, network). My problem is that I'm not allowed to do so. I need a way to save and recover object state without writing it on "external" memory. Maybe to save it on heap or stack...
Please don't offer to clone it, I'm not allowed to do so as well.
Thanks.
I'm struggling to get association right on Grails. Let's say I have two domain classes:
class Engine {
String name
int numberOfCylinders = 4
static constraints = {
name(blank:false, nullable:false)
numberOfCylinders(range:4..8)
}
}
class Car {
int year
String brand
Engine engine = new Engine(name:"Default Engine")
static constraints = {
engine(nullable:false)
brand(blank:false, nullable:false)
year(nullable:false)
}
}
The idea is that users can create cars without creating an engine first, and those cars get a default engine. In the CarController I have:
def save = {
def car = new Car(params)
if(!car.hasErrors() && car.save()){
flash.message = "Car saved"
redirect(action:index)
}else{
render(view:'create', model:[car:car])
}
}
When trying to save, I get a null value exception on the Car.engine field, so obviously the default engine is not created and saved. I tried to manually create the engine:
def save = {
def car = new Car(params)
car.engine = new Engine(name: "Default Engine")
if(!car.hasErrors() && car.save()){
flash.message = "Car saved"
redirect(action:index)
}else{
render(view:'create', model:[car:car])
}
}
Didn't work either. Is Grails not able to save associated classes? How could I implement such feature?