Whats wrong with TStatusBar? - database

I have two forms called fmMain and fmEmpl. Both have each TStatusBar called sbMain and sbEmpl. I have a TDataModule called dmData to store the database components.
I need to update the sbEmpl panels so it can displays actual values from the database when the cell grid is highlighted. I've been try to use the TClientDataSet's OnAfterScroll handler to handling this event but it just working on fmMain only, not with fmEmpl. It always raising error message if I try to update the sbEmpl panels. This is the message:
Access violation at address 00405337 in module 'SpeZet.exe'. Read of address 0000038C.
Whereas, I have including both header (.h) on dmData.
What going wrong with TStatusBar here?
Any idea?
Thank a lot in advance.
EDIT : Ok, here is the code:
void __fastcall TdmData::cdsEmplAfterScroll(TDataSet *DataSet)
{
vEmpl = "Name = " +
dmData->cdsEmpl->FieldByName("Name")->AsString +
" | idEmployee = " +
dmData->cdsEmpl->FieldByName("idEmployee")->AsInteger +
" | idJob = " +
dmData->cdsEmpl->FieldByName("idJob")->AsInteger;
fmMain->sbMain->SimplePanel = true;
fmMain->sbMain->SimpleText = vEmpl;
fmEmpl->sbEmpl->SimplePanel = true;
fmEmpl->sbEmpl->SimpleText = vEmpl;
}
The "Access Violation" message is raised at line:
fmEmpl->sbEmpl->SimplePanel = true;
fmEmpl->sbEmpl->SimpleText = vEmpl;

Most probably your datamodule doesn't have a valid pointer to your fbEmpl form.

Finally, based on this article, I have solve this problem.. I didn't notice that dmData is created before the fmEmpl so it will raising any "Access Violation" error message when I try to access the fmEmpl.
I make simple condition to check if fmEmpl was created or yet. This is the condition:
if (fmEmpl != NULL) {
sbEmpl->SimplePanel = true;
sbEmpl->SimpleText = sData;
}
Now, I can accessing and updating the sbEmpl directly from dmData.
Thanks.

Related

Perform Action Based on Checking Box in Adobe using Javascript

I'm attempting to change a textbox value whenever a user checks a checkbox in Adobe Acrobat Pro XI using Javascript, and am inexperienced in it. I am getting an error of Syntax Error: Illegal Character 7: at line 9 based on the below code:
//Checked
if (this.getField("myCheckBox").value != "Off") {
this.getField("myTextBox").value = util.printd("mm/dd/yyyy HH:MM:ss", new Date());
//Not Checked
} else {
this.getField("myTextBox ").value = “”;
}
I have the feeling I need to change the brackets somehow, can anyone clarify?
Thanks for any help!
the quotation marks in the else clause are not the "correct" quotation marks
this.getField("myTextBox ").value = “”; // <-- change these to ""
also, probably need to remove the white-space after "myTextBox "
try...
this.getField("myTextBox").value = "";

Google Identity Toolkit Java library's gitkitClient.getAllUsers() doesn't work correctly

I have been trying to get all the users for my web application (GAE for Java backend) using gitkitClient.getAllUsers(). I'm just getting started with Identity Toolkit and have 10-12 users.
When I call gitkitClient.getAllUsers() it doesn't find any user and returns this warning:
com.google.identitytoolkit.GitkitClient$1 getNextResults
WARNING: JSONObject["email"] not found.
If I call it with a parameter for max results gitkitClient.getAllUsers(5), it returns 5 users correctly. But if I pass 7, it again doesn't find any user, and returns the same warning (as above). I know that I have 10+ users.
If I use gitkitClient.getUserByEmail("test#example.com") I can get the users that are not returned in the first 5.
Here's my code sample:
Iterator<GitkitUser> allUsers = gitkitClient.getAllUsers();
int count = 0;
if (allUsers != null) {
while (allUsers.hasNext()) {
count++;
GitkitUser gUser = allUsers.next();
logger.info("" + count + ". User email : " + gUser.getEmail() + " Id : " + gUser.getLocalId());
}
}
Am I missing something?
Are you using the iterator like this:
val userIterator = gitkitClient.getAllUsers();
while (userIterator.hasNext()) {
LOG.warning(userIterator.next().getEmail)
}
I've not been keeping to close an eye on the number of users, but this seems to return ALL of the known users.
B.

Use twitchAPI with cake

since a few hours i'm trying to implement the twitchAPI in my cake projet. a long time ago i made this little script in basic php.
$channelName = "gamespot";
$json_file = #file_get_contents("http://api.justin.tv/api/stream/list.json?channel={$channelName}", 0, null, null);
$json_array = json_decode($json_file, true);
#$json_array[0] && $json_array[0]['name'] == "live_user_{$channelName}";
#$title = $json_array[0]['channel']['status'];
#$game = $json_array[0]['meta_game'];
#$chanel_view = $json_array[0]['channel_count'];
#$totalchanelview = $json_array[0]['channel_view_count'];
but i don't know how to add this lines on my controller
For know i've just find this
public function twitch() {
$json = file_get_contents('http://api.justin.tv/api/stream/list.json?channel=manvsgame');
$twitch = json_decode($json);
$totalchanelview = $twitch[0]['channel_view_count'];
$this->set('twitch', 'totalchanelview');
}
but of course i've this error
Fatal error: Cannot use object of type stdClass as array in /Users/*/Desktop/Websites/**/app/Controller/UsersController.php on line 29
anyone can explain to me how i can use this API?
thanks in advance and have a nice day/night :)
okey first thanks to help me. i still have a little "logic problem"
my function is something like that:
public function twitch() {
$json = file_get_contents('http://api.justin.tv/api/stream/list.json?channel=gamespot');
$twitch = json_decode($json, true);
$this->set('json', $twitch);
}
but know, what can I write to my view to see my informations (like the title of my stream for exemple.
I test with
echo $twitch[0]['title']; (it's my line 1)
bit i've this error
Notice (8): Undefined variable: twitch [APP/View/Users/admin_dashboard.ctp, line 1]
$twitch = json_decode($json, true); // add true param
$twitch[0]['channel_view_count'];
adding true returns the data as an associated array instead

Trying To Prevent Repost Data on refresh

working with pre existing code just a simple patch i added ontop
//first get the variables
bridge = namef & valuef
//a paranoid double check
if session("gap") = session("oldgap") then session("gap") = "null"
//the actual comparison
if bridge = session("gap") then
drawbridge = ""
else
drawbridge = inputscrubber("action")
end if
session("oldgap") = session ("gap")
session("gap") = namef & valuef
You should use the PRG (Post/Redirect/Get) pattern to avoid such issues.
The idea is that once the form is posted, you process it and redirect to a different page. The user at this point can refresh without any issue.

Mass update case Status - Salesforce

I am looking for a way to mass update case Status and leave a success message or failure message with failed case ID.
I currently have validation rules and triggers for update or cases. But I need to keep show at least the first failed case ID in the error message.
Is there a way to put a variable in the validation rule error message? Or its explicitly string?
I currently use a validation rule but I cant show the failed case in my error message because I cant put a variable in the error message.
Check this Link it might help you http://appexchange.salesforce.com/listingDetail?listingId=a0N30000003IleFEAS
You need to use a before trigger in this case and compare the list of selected cases before and after the update.
Or you can create a custom button and add it to the page and run the desired javascript to check what changed before and after.
something like this :
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var idArray = {!GETRECORDIDS($ObjectType.Case)};
var err = [];
var caseObj;
for (i=0; i< idArray.length ; i++){
caseObj = new sforce.SObject("Case");
caseObj.Id = idArray[i];
caseObj.Status = *** //change status here;
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
err.push("\n"+result[0].errors.message + " Case ID "+idArray[i]);
}
}
if(err.length >0)
{
alert(" The following cases have failed to change status: \n\n" +err);
}
location.reload(true);

Resources