2015年07月

Having an object required error in Access. Every other situation here is far too complex

I'm a new access programmer and I've been tasked with taking the old school index card / excel spreadsheet inventory system at work (an internship) and making an access database (because interns always get the "fun" jobs) Anyway, I say that other situations here are too complex because mine is really simple. My function follows as thus:



Public Function PartNumMod()
On Error GoTo Part_Number_Macro_Err
DoCmd.Requery "Subform1"
Forms!Subform1.SourceObject = Queries![Part Number Query]
Part_Number_Macro_Exit:
Exit Function
Part_Number_Macro_Err:
MsgBox Error$
Resume Part_Number_Macro_Exit
End Function


This function is called from a button on a form called Search form. Any help would be greatly appreciated.



SELECT Inventory.[PART NUMBER], Inventory.DESCRIPTION, Inventory.Location, Inventory.[B#9 Of], Inventory.[B#11 FM], Inventory.[B#14 DA], Inventory.[B#15 TL], Inventory.[B#16 WH], Inventory.[B#17 MH], Inventory.[B#22 TN], Inventory.[B#24], Inventory.QTY
FROM Inventory
WHERE (((Inventory.[PART NUMBER]) Like "*" & [Forms]![Search Form]![WhatPart] & "*"));


Here is part number query as requested.



Answers

I found the problem. I wasn't referencing things correctly. Following is my code, all prettied up and ready to see daylight.



'Tests to make sure that the subform isnt already loaded with the query
If Forms![Search Form]!Subform1.SourceObject <> "Query.Part Number Query" Then
'In theory, this should change the source of the subform to display the part number query
Forms![Search Form]!Subform1.SourceObject = "Query.Part Number Query"
End If

'Runs the requery on subform to refresh
DoCmd.Requery "Subform1"


So yeah. Resolution. Lets pray the boss likes it.



Thanks guys,



Santh





JavaScript search words in string

I am trying to solve this exercise but really it seems impossible.



Write a Javascript function that, given a string and a dictionary of words, determines whether all the words of the dictionary (and only those words) are contained in the string.



Forbidden functions:
String.prototype.indexOf()
String.prototype.charAt()
String.prototype.endsWith()
String.prototype.startWith()
String.prototype.includes()
String.prototype.match()
String.prototype.lastindexOf()
String.prototype.search()
String.prototype.replace()
String.prototype.substring()

EXAMPLE OF GOOD PROVIDER:
string: 'foobarfooba'
dictionary: 'foo', 'bar', 'fooba'

string: 'foobarfoobarbarfooba'
dictionary: 'foo' 'bar' 'fooba'

EXAMPLE OF BAD PROVIDER:
string: 'foobarfoobas'
dictionary: 'foo', 'bar', 'fooba'

string: 'foobarfooba';
dictionary: 'foo', 'bar'




Sending and Recieving PNGencoded to php mysql BLOB

I'm trying to send encoded data for a bitmap image to a server and back to the( or a separate) client. There's probably an easier way to do this with sockets or something, but I'm a very casual and still a pretty new programmer and I had trouble understanding other methods. The encoding and decoding works fine and I can save and open up the encoded png, but somewhere on the php/mysql side the encoded data loses most of it's code.



Actionscript code for sending the encoded data to the php.



var req:URLRequest = new URLRequest("http://host.net//img.php");
req.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader;
var phpvar = new URLVariables();

var shape:MovieClip = new MovieClip();
shape.graphics.beginFill(0xFF0000);
shape.graphics.drawRect(0, 0, 100, 100);
addChild(shape);
var bmp:BitmapData = new BitmapData(500, 350);
bmp.draw(shape);

var byte:ByteArray = new ByteArray();
bmp.encode(new Rectangle(0,0, 100, 100), new flash.display.PNGEncoderOptions(false), byte);

//save on database
phpvar.bytez = byte;
req.data = phpvar;
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(req);

trace(req.data.bytez);


The traced output is:




PNG



->



IHDRddÿIDATxÚíÐ1 µçYÁÏ"Ð)®F,Y²dɒ¥@,Y²dÉR
K,Y²d)%K,Y²Ȓ%K,Y dɒ%K,²dɒ%KY²dɒ%K,Y²dɒ¥@,Y²dÉR
K,Y²d)%K,Y²Ȓ%K,Y dɒ%K,²dɒ%KY²dɒ%K,Yß^Çjú··IEND®B`




Actionscript code for recieving data:



var req = new URLRequest("http://host.net//imgsend.php");
var loader = new URLLoader(req);


loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(req);



function onComplete(e:Event) {
var loaderer:Loader = new Loader();
var byte:ByteArray = new ByteArray()

byte = e.target.data;
trace(byte);
}


Traced output is:




PNG



->




For some reason it knows the encoded data is for a PNG, but all there is is a header. I think the problem is in my php/mysql code, but I'm not completely sure here. I'm using a free webhosting service with myphpadmin for convenient sake, the Images table is just a BLOB column and the php files are uploaded on the host server.



PHP code for reading and inserting into mysql (img.php)



<?php
mysql_connect($mysql_host, $mysql_user, $mysql_password);

mysql_select_db($mysql_database) or die(mysql_error());


$pic = $_POST['bytez'];


$sql = "INSERT INTO Images (img) VALUES ('$pic')";

mysql_query($sql);
?>


PHP code for taking the data form the server and sending it to Actionscript (imgsend.php)



<?php
mysql_connect($mysql_host, $mysql_user, $mysql_password);

mysql_select_db($mysql_database) or die(mysql_error());




$sql = "SELECT * FROM Images";

$records = mysql_query($sql);

while($byte=mysql_fetch_assoc($records)){

echo $byte['img'];

}

?>


I know the php code is sloppy at best, and I'll deal with processing what gets fetched by the query when the time comes. Any help would be great, even if you just help me clean up the sloppy code lol.



Answers

I didn't necessarily find an answer to this exact method, but I found an alternate solution, ie writing the file directly into the directory. From what I've read this is much more efficient anyways. The code is basically the same only I added URLcontentType and extended the URL for the URL request address for the file's location.



var req:URLRequest = new URLRequest("http://host.net//img.php?filename=something.png");
req.method = URLRequestMethod.POST;
req.contentType = "application/octet-stream";

var loader:URLLoader = new URLLoader;


var shape:MovieClip = new MovieClip();
shape.graphics.beginFill(0xFF0000);
shape.graphics.drawRect(0, 0, 100, 100);
addChild(shape);
var bmp:BitmapData = new BitmapData(500, 350);
bmp.draw(shape);

var byte:ByteArray = new ByteArray();
bmp.encode(new Rectangle(0,0, 100, 100), new flash.display.PNGEncoderOptions(false), byte);

//save on database
req.data = byte;
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(req);


The PHP code is for img.php is:



<?php

$fileName = $_GET['filename'];

$fp = fopen( $fileName, 'wb' );

fwrite( $fp, $GLOBALS['HTTP_RAW_POST_DATA'] );

fclose( $fp );

?>


Loading the file is simple, not going to bother posting that. I'll deal with unique file names on my own, baby steps. Thanks for helping me talk this out some!





video poster on pause

I'm using the following trick to avoid the bug of videos caching in chrome



$("video").each(function(index){
$(this).get(0).load();
$(this).get(0).addEventListener("canplaythrough", function(){
this.play();
this.pause();
});
});


The thing is, that it messes with the poster image (which is not the first frame in the video)



All the solutions I see to returning to the poster is reloading the video - won't it get me back to the same trouble?



So in short:
How do I get the poster image back after the play/pause...





Looking DICOM ECG viwer open source HTML5 or any web based codes

I use oviyam2 for open DICOM images but it can't open DICOM ECG images. Can I open that using Oviyam or any other open source code to open ECG dicom files in web browser?





↑このページのトップヘ