convert pipe separated text file data to xml format in php

Uncategorized
Question: I have a text file generated by a device which provides me the data in this form:Rajeet Singh|email@gmail.com|0123456789|Delhi Abhishek|email2@gmail.com|0123456987|Pune I want to extract the data from the text file and convert it into XML form as shown below: Rajeet email@gmail.com 0123654789 Delhi Abhishek email@gmail.com 0123654789 Pune This is what I have done so far. I have extracted the data from the text file and converted into an array. $fh=fopen('file/dat.txt','r'); $xml = new SimpleXMLElement(''); while($line=fgets($fh)){ $line_arr=explode('|',$line); } And converted a static valued array to xml like this:$users_array = array( array( "name" => "Rajeet", "email" => "email@gmail.com", "mobile" => "0123654789", "address" => "Delhi", ), array( "name" => "Abhishek", "email" => "email@gmail.com", "mobile" => "0123654789", "address" => "Pune", ) ); print_r($users_array); //function defination to convert array to xml function array_to_xml($array, &$xml_user_info) {…
Read More

Tensorflow inception-v4 Classify Image

Uncategorized
Question: I use TF-slim inception-v4 training a model from scratch. python train_image_classifier.py --train_dir=${TRAIN_DIR} --dataset_name=mydata --dataset_split_name=train --dataset_dir=${DATASET_DIR} --model_name=inception_v4 --clone_on_cpu=true --max_number_of_steps=1000 --log_every_n_steps=100 # Run evaluation. python eval_image_classifier.py --checkpoint_path=${TRAIN_DIR} --eval_dir=${TRAIN_DIR} --dataset_name=mydata --dataset_split_name=validation --dataset_dir=${DATASET_DIR} --model_name=inception_v4 --batch_size=32 # # # Fine-tune all the new layers for 500 steps. python train_image_classifier.py --train_dir=${TRAIN_DIR}/all --dataset_name=mydata --dataset_split_name=train --dataset_dir=${DATASET_DIR} --model_name=inception_v4 --clone_on_cpu=true --checkpoint_path=${TRAIN_DIR} --max_number_of_steps=1000 --log_every_n_steps=100 --batch_size=32 --learning_rate=0.0001 --learning_rate_decay_type=fixed --save_interval_secs=600 --save_summaries_secs=600 --optimizer=rmsprop --weight_decay=0.00004 then freeze the graph:python export_inference_graph.py --alsologtostderr --model_name=inception_v4 --is_training=True --labels_offset=999 --output_file=${OUTPUT_DIR}/unfrozen_inception_v4_graph.pb --dataset_dir=${DATASET_DIR} #NEWEST_CHECKPOINT=$(cat ${TRAIN_DIR}/all/checkpoint |head -n1|awk -F" '{print $2}') NEWEST_CHECKPOINT=$(ls -t1 ${TRAIN_DIR}/all|grep model.ckpt |head -n1) echo ${NEWEST_CHECKPOINT%.*} python ${OUTPUT_DIR}/tensorflow/tensorflow/python/tools/freeze_graph.py --input_graph=${OUTPUT_DIR}/unfrozen_inception_v4_graph.pb --input_checkpoint=${TRAIN_DIR}/all/${NEWEST_CHECKPOINT%.*} --input_binary=true --output_graph=${OUTPUT_DIR}/frozen_inception_v4.pb --output_node_names=InceptionV4/Logits/Predictions --input_meta_graph=True After all this, I got a frozen_inception_v4.pb file. for this example https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/label_image/label_image.py what is the input layer for inception_v4 ? Does anyone know how to solve this? Answer: Read more
Read More

VB.NET Event Handler as the producer of a multithreaded producer-consumer pattern

Uncategorized
Question: The pattern below smells for a few reasons, but for the purposes of this question, let's focus on the global variables and the event handler:Dim objectQueue As New BlockingCollection(Of Object) Dim objectQueueCancel As New CancellationTokenSource Sub Main() Task.Run(Sub() If Console.ReadKey.KeyChar() = "c" Then objectQueueCancel.Cancel() End Sub) Dim t1 As Task = Task.Run(Sub() NonBlockingConsumer()) Dim t2 As Task = Task.Run(Sub() NonBlockingProducer()) Task.WaitAll(t1, t2) objectQueueCancel.Dispose() Console.WriteLine("Press the Enter key to exit.") Console.ReadLine() End Sub Private Sub NonBlockingProducer() Dim sourceObjects As ICollection(Of Object) = Nothing 'Sanitized for StackOverflow For Each sourceObject In sourceObjects If sourceObject.IsEnabled Then Dim objectEventGenerator As New objectEventGenerator(sourceObject) AddHandler objectEventGenerator.objectEvent, AddressOf Handler_ObjectEvent objectEventGenerator.Enabled = True End If If objectQueue.IsAddingCompleted Then Exit For Next sourceObject End Sub Public Sub Handler_ObjectEvent(ByVal sender As Object, ByVal e As objectEventArgs) If Not objectQueue.IsAddingCompleted…
Read More

Is there a possibility that i can access excel's file details?

Uncategorized
Question: $objPHPExcel->getProperties()->setCreator("Sample") ->setLastModifiedBy("Sample") ->setTitle("Office 2007 XLSX Test Document") ->setSubject("Office 2007 XLSX Test Document") ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") ->setKeywords("office 2007 openxml php") ->setCategory("Test result file"); i have put password on cell, so that user cannot modify some of the cell value, but when a user copy all data and paste all data to a new excel file, i cannot verify the authenticity of the cell value anymore. so what i want to do is to compare two excel files if it is still the program generated file or created by user? Answer: You can e.g. create one extra sheet and sign him with hidden attribute. So when user copy and paste data, he doesn't copy extra sheet, because he doesn't know about him. Try explore…
Read More

Does Google index javascript ALTERED content over original content?

Uncategorized
Question: I know Google nowadays is pretty good at scanning the DOM and adding stuff to your site using javascript isn't a problem anymore. Thing is, I'm using javascript (jQuery) to collect information from a perfectly good structured web-page to make some sort of widget. I'm too ashamed to show code because, really, it's a bit of a mess. And not really relevant to my question. So in the original content there's something like this:Title Content here Title two Content two I'm collecting shit from all over the page to rearrange it into stuff I don't want Google to see like this:TitleTitle two content hereContent two Again, please don't just my old and horrible ways of thinking here. The question I'm trying to ask is; Does Google now read the…
Read More

Detect a face while my cam is open

Uncategorized
Question: i need to build an app with just a cam view, and it should detect my cam is looking at a face, can anyone point me in the right direction? I have built something that detects a face on an image, but i need to work with a cam, here is what i have done so far:- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *path = [[NSBundle mainBundle] pathForResource:@"picture" ofType:@"JPG"]; NSURL *url = [NSURL fileURLWithPath:path]; CIContext *context = [CIContext contextWithOptions:nil]; CIImage *image = [CIImage imageWithContentsOfURL:url]; NSDictionary *options = @{CIDetectorAccuracy: CIDetectorAccuracyHigh}; CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:context options:options]; NSArray *features = [detector featuresInImage:image]; } Answer: Read more
Read More

Exclude some classes from being logged in EMAIL appender in log4j

Uncategorized
Question: I am using properties file configuration for log4j. log4j.rootLogger=INFO, A1, EMAIL log4j.appender.EMAIL.Threshold = ERROR I created email appender so errors would be sent to my email. There is exception that occures over 60000 times a day and i would like it to exclude it from logging.I added this line :log4j.logger.java.lang.IllegalStateException=OFF but its still getting logged. Is there some other way of excluding it, maybe by filters ? Answer: Read more
Read More