system call hacking in linux for arm

Uncategorized
Question: I am trying to write a kernel module that will replace system calls for linux 4.9. All the solutions on the Internet are specific to x86 but I am working on Beaglebone Black that has an arm cortex A8. This is what I have done so far. static unsigned long *sys_call_table; // this is a global The module when insmoded appears as a device in /dev which the user can open and give an ioctl command. In ioctl I use sys_call_table=(void*)kallsyms_lookup_name("sys_call_table"); which obtains the same address as given in System.map file. But the moment I try to change system call using *(sys_call_table + __NR_open) = (unsigned long)custom_open; It gives errors. they are [ 155.354417] Unable to handle kernel paging request at virtual address c01079f8 [ 155.361959] pgd = de6c0000…
Read More

Ember.js: binding to dynamic form inputs

Uncategorized
Question: I'm trying to figure out the proper way to collect "variable" personalized data on a product. The product has these personalized fields defined:"personalization": [ { "id": 234, "maxlength": "128", "prompt": "Text Line 1 (12 character limit)", "required": "1" }, { "id": 235, "maxlength": "128", "prompt": "Text Line 2 (12 character limit)", "required": "1" } ], Building a small form to collect that input would be fairly straightforward, except that personalized data can be different for each quantity. So if I order 2 of this item, it can have personalization:FIRST ITEM Text Line 1: Yarr Text line 2: Matey SECOND ITEM Text Line 1: Swab Text line 2: The poop deck So basically the set of personalized fields needs to repeat for each quantity. I've got the form built using…
Read More

In Angular test, confused about the concept on a component that uses a service that uses HttpModule

Uncategorized
Question: I am pretty new to Angular. I am looking at the test after understanding how the framework operates. I found that a component that uses a service and if that service uses HttpModule, the component test spec file also need to have the HttpModule imported. I don't really understand the concept behind. I think a component that uses the module should not need to know how the service works, as it is kind of an encapsulated process that the service performs. And changing a service that doesn't change the api should not break the component as well. If my understanding is correct, then if there is a component that don't use HttpModule at the very beginning of the development, then someone write a component base on that service, and…
Read More

Multiprocess a list of commands

Uncategorized
Question: Im trying to run a list of commands. The problem is that the list can be very long, so having multiple commands run simultaneously would be great. How do I do this with the multiprocessing module? list_of_commands = [cmd foo, cmd bar, ...] main_log_file = open( os.getcwd() + '/Error.log', 'w+') Count = 0 for Job in list_of_commands:Count += 1 child = subprocess.Popen(Job, stdout=subprocess.PIPE, stderr=subprocess.PIPE) streamdata = child.communicate()[0] errcode = child.returncode if errcode == 0:print ( 'Job', Count, 'Success' ) elif errcode == 1:print ( 'Job', Count, 'Completed With Errors' ) elif errcode == 2:print ( 'Job', Count, 'Error' ) main_log_file.write ( streamdata.decode('ascii') + str(errcode) + 'n' ) main_log_file.close() Order of execution doesn't matter Answer: You can use the concurrent.futures.ThreadPoolExecutor map function to run a costant number of parallel executions.…
Read More

Spring Cloud DataFlow Composed Task doesn’t start

java
Question: I'm trying to run SCDF Composed Task. Any composed tasks that I create does the same thing: executes SQL script: Executing SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql]` And on that point execution pauses. In Executions tab of SCDF Dashboard at Start time and End time I see N/A. I'm using Spring Cloud DataFlow 1.2.3.RELEASE and Composed Task Runner 1.0.0.RELEASE. Here's the output from logs: 2017-08-18 18:20:09.455 INFO 828 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888 2017-08-18 18:20:10.528 WARN 828 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/composedtaskrunner-task/default": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect 2017-08-18 18:20:10.530 INFO 828 --- [ main] .t.a.c.ComposedtaskrunnerTaskApplication : No active profile set, falling back to default profiles: default…
Read More

using loop to concatenate elements of arrays in Java in a python like way

Uncategorized
Question: I am new to java. I have done python before and concatenating elements of two lists or arrays seemed easy with loop. But how to do the same with java??? For example, I have a multidimensional array: //codes String [][] nameAry={{"Mr.","Mrs.","Ms."},{"Jones","Patel"}}; //The output I am expecting :Mr. Jones, Mrs. Jones, Ms, Jones, etc. // I can do it by handpicking elements from indices, as shown in oracle documentation, but what I am looking for is a loop to do the job instead of doing: //code System.out.println(nameAry[0][0]+", "+nameAry[1][0]); ` ////So, is there a way to put it the way I do in python,i.e.,:x=["Mr.","Mrs.","Ms."] y=["Jonse","patel"] names-[a+b for a in x for b in y] ///this gives me the following result:['Mr.Jonse', 'Mr.patel', 'Mrs.Jonse', 'Mrs.patel', 'Ms.Jonse', 'Ms.patel'] //So, is there something like this…
Read More

convert file path list to tree

Uncategorized
Question: There is a python file path list like below:file_path_list = ["test/dir1/log.txt", "test/dir1/dir2/server.txt", "test/manage/img.txt"] I want to convert it to a tree. the expect result is below:tree_data = [ { "path": "test", "children": [ { "path": "dir1", "children": [ { "path": "log.txt" }, { "path": "dir2", "children": [ { "path": "server.txt" } ] } ] }, { "path": "manage", "children": [ { "path": "img.txt", } ] } ] } ] What's the best way to convert? update: my code is below, but I think it's not well. def list2tree(file_path):"""Convert list to tree.""" tree_data = [{ "path": "root", "children": [] }] for f in file_path:node_path = tree_data[0] pathes = f.split("/") for i, p in enumerate(pathes):length = len(node_path["children"]) if not length or node_path["children"][length - 1]["path"] != p:# create new node new_node =…
Read More

How to implement transaction support for LevelDB in Java?

Uncategorized
Question: I am currently using leveldbjni-1.8 to implement a LevelDB based database. But it only supports basic operations like put(),get(),delete() and iterate() and there is no any transaction support to the database. When I searched for libraries for providing transaction support for LevelDB, most of them were JavaScript libraries like this. But I require either a Java library which supports LevelDB transactions or any other separate transaction layer to implement in the application. So, is there any suggestions to implement transaction support for LevelDB in Java. Thanks in advance. Answer: Read more
Read More