I am trying to execute this example code using Python2.7 and it is throwing me error as 'module' object has no attribute 'table'. Can any one help me regarding the correct html module. import html file = open('1.html', 'w') table_data = [ ['S.No', 'test1 - role'], ['1', 'a', 'b'], ['2', 'c', 'd'], ] htmlcode = html.table(table_data) c=htmlcode print htmlcode file.writelines(c)
I want to construct a RPC Program to transfer any type of files. But I am getting segmentation fault after running the client:such as ./file_client localhost >get /home/ab/1.txt >put /home/1.txt Segmentation Fault For your convenience I am pasting my client and server and .x code: file.x const MAXLEN = 1024; /* * Type for storing path */ typedef string filename<MAXLEN>; /* * Structure for sending request. Expects the path of the file * and the byte number at which to start reading the file from */ struct request { filename name; int start; }; /* * Type that represents the structute for request
I'm new to CodeIgniter and trying to developing a fairly simple application with it -- just a form to process the registration for employees wanting a recreation center pass. I'm trying to separate things to make them cleaner. Here is the code: application/controllers/reccenter.php class RecCenter extends CI_Controller { public function register() { $data['title'] = "Utah Valley Rec Center Registration"; $this->output->enable_profiler(TRUE); // Put all the debug statements at the bottom of the page $this->load->helper('html'); $this->load->library('form_validation'); $this->form_validation->se
I am trying to save a number, date time and an image to access database using c# application. i have written a function which converts image to base64string format and then i use the function to get image as a string and later save it. I however get an error saying 'argument NULL exception was unhandled'. this error occurs at the following line in the code image.Save(stream, image.RawFormat);* my code is as follows: private void save_Click(object sender, System.EventArgs e) { string oneimg=ImageToBase64String(pictureBox1.Image); string twoimg=ImageToBase64String(pictureBox2.Image); OleDbConnec
Background I have a layout that has some special states (like being checked/pressed), and I wish to set its children to apply their own drawables based on this layout. i'm searching for an alternative of setting duplicateParentState to true for each of its children (and maybe even all of its descendants). What I've tried I've tried to make the custom view have an attribute of setting it to each of its children, but i couldn't find in which method call to apply this attribute to all of its children. in each method i've tried, it either returns 0 for getChildCount() or it just doesn't do anythin
I'm at the moment trying to send a right click to a computergame without affecting my visible mouse pointer. I'm not sure if the game just doesn't like it or if I'm doing something wrong. Here is the short-version of my code: WORD tx = 500; WORD ty = 500; HWND windowHandle = FindWindow(NULL,TEXT("Game title")); if (windowHandle != 0) { SendMessage(windowHandle, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(tx, ty)); Sleep(50); SendMessage(windowHandle, WM_RBUTTONUP, MK_RBUTTON, MAKELPARAM(tx, ty)); Sleep(50); std::cout << "message sent..." << std::endl; } I tried this many times and made sure that th
I understand that my question is somehow wrong, but I'm still trying to solve this problem. I have an interface Programmer: interface Programmer { public function writeCode(); } and a couple of namespaced classes: Students\BjarneProgrammer (implements Programmer) Students\CharlieActor (implements Actor) I have this class names stored in array $students = array("BjarneProgrammer", "CharlieActor"); I want to write a function, that will return an instance of class if it's implementing Programmer interface. Examples: getStudentObject($students[0]); - It should return an instance of BjarneProgramme
For one of my methods, its role is to switch the first and last elements of an array. It worked just fine when I had the array built into the method. But then I decided to just have it read in an array from main and now it doesn't work right. It replaces different numbers each time or sometimes doesn't replace anything and just copies the array. Examples: 20432 20432 and 44413 44431 and 42203 public static void main(String[] args) { int[] array = new int[5]; int length = array.length; for (int i = 0; i < length; i++) { array[i] = (int)(Math.random () * 5); System.out.print(array[i]); } System.
I plan to create an Oracle database that will contain arrays of numeric data. Each array has from 2 to 4 dimensions, and on the order of 1000 data points. I will want to use the arrays in WHERE clauses, e.g. . Oracle's array support (VARRAYS, Nested Tables) seems disappointing; it's awfully hard for client software to retrieve the data in a useful way. Possible, but hard. Any advice is appreciated.
I have a project that requires sending live video stream to a web-client. I have a server app that actually makes live video stream out of Direct3D scene using DirectShow. I have my own DirectShow source filter and its output is compressed using WEBM codec. It works well when saving video stream to a file, that can later be viewed without any problems. But next step is to translate live video stream to a web client. I tryied to send it via TCP to my ASP.NET MVC4 application. My page controller looks as folows: public class VideosController : ApiController { /// <summary> /// Web API method to
I am writing a security system that denies access to unauthorized users. name = input("Hello. Please enter your name: ") if name == "Kevin" or "Jon" or "Inbar": print("Access granted.") else: print("Access denied.") It grants access to authorized users as expected, but it also lets in unauthorized users! Hello. Please enter your name: Bob Access granted. Why does this occur? I've plainly stated to only grant access when name equals Kevin, Jon, or Inbar. I have also tried the opposite logic, if "Kevin" or "Jon" or "Inbar" == name, but the result is the same. This question is intended as the can
The errors that show up are for undefined symbols, not the Cairo functions I copied from the example, but what I guess are internal functions. I have looked around and tried using $(pkg-config --cflags --libs cairo), verbatim from a common online example using the terminal. I tried that after using EXPORT=(my path to cairos .ps file). I currently have one option in CodeBlocks 'Link Libraries' in the linker settings: /usr/lib/x86-linux-gnu/libcairo.a Also, I have /usr/include/cairo in my compiler options. Errors: /usr/lib/x86_64-linux-gnu/libcairo.a(cairo-image-source.o)||In function _cairo_ima
Newly setup the eclipse and and TestNG. I have downloaded the Jar file zip from selenium website but on execution of example FAILED CONFIGURATION: @BeforeMethod setUp java.lang.NoClassDefFoundError: is coming import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; import org.testng.annotations.BeforeMethod; import org.testng.Assert; import java.util.concurrent.TimeUnit; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; public class Login { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private Strin
I'm looking for a way to mask specific code lines in the IDE. I prefer doing it in eclipse, but intellij would be fine also. The purpose is, that when I have a method like this: public String serialize() { log.info("Starting to serialize"); StringBuilder sb = new StringBuilder(); sb.append("name: " + this.name); sb.append("age: " + this.age); sb.append("sex: " + this.sex); log.info("Finished serializing. The result is: " + sb.toString()); return sb.toString(); } I will make it look like this: public String serialize() { StringBuilder sb = new StringBuilder(); sb.append("name: " + this.name); s
In my emulator, when I try to do an upgrade of my apk programmatically. I get: Android App Not Install. An existing package by the same name with a conflicting signature is already installed I'm still in the testing phase of this upgrade, so the file I download is a signed apk of a previous version, which I think should work without any issues. From the suggestion in: an existing package by the same name with a confilcting signature is already installed I tried to run the emulator both in debug mode and in normal mode... neither worked. Any thoughts on what I'm missing?
Below code with spire.doc var doc = new Document(); doc.LoadFromFile(@"E:\test.docx", FileFormat.Doc); var image = Image.FromFile(@"E:\nice.jpg"); var picture1 = doc.Sections[0].Paragraphs[0].AppendPicture(image); picture1.VerticalAlignment = ShapeVerticalAlignment.Top; picture1.HorizontalAlignment = ShapeHorizontalAlignment.Left; picture1.TextWrappingStyle = TextWrappingStyle.Square; doc.SaveToFile(@"..\..\result.doc", FileFormat.Doc); System.Diagnostics.Process.Start(@"..\..\result.doc"); How can I insert image and text into certain positions in a Word template using either the spire.doc or
It is documented in http://scikit-learn.org/0.9/modules/feature_selection.html "Warning Beware not to use a regression scoring function with a classification problem." I am trying to find the best features for a regression problem and using f_regression as the scoring function. But it is extremely Memory hungry and my 8GB machine hangs and finally I get Memory error. I have used Chi2 as a scoring function for the same problem and it works very fast. Wanted to know if the reverse of the warning is true ? If not can I use Chi2 as a scoring function for regression problem ?
I have following code in .NET 4.5 to send email attachment using SmtpClient. I am adding memory stream created below to Attachement collection of message. using System.IO; using System.IO.Compression; var memoryStream = new MemoryStream(); using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true)) { archive.CreateEntryFromFile(@"c:\Files\File1.txt", "File1.txt"); } When I receive a email, it shows zip file but the archive does not have File1.txt. What's missing here?
I have a chat bot which save some data into db which user is sending. I want to save it to db (a slow network call) after sending response to the user. I could do that in Python Tornado but I havent been able to do it PHP Apache. user sends input as request -> we process it -> we send output to user as response -> then we wish to store data class A { function __construct() { echo "Hello World"; } function __destruct() { sleep(15); //I want this to happen after response is being send } function calc() { echo "Progress World"; } }
I'm having a problem with my Javacalculator. It sometimes gives me weird results, such as 357856 * 42342 = -2027530432 Could someone try to explain to me why this happens? Also it crashes when I use too big numbers, but I think that's kind of normal. Here's my activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddin
I have two ListBoxes. ListBox1 has list of items that can be selected by the user to transfer to ListBox2 by either double clicking the item or pressing the add button. What I want to do now is to prevent the user from adding duplicates in ListBox2. If ever a duplicate is detected a message will prompt "Item already included" and end the code. I am guessing this can be done with contains? But I have no idea how to do it. I have the following codes: 'Report Listing Private Sub UserForm_Initialize() 'List of Reports With ListBox1 .AddItem "Report 1" .AddItem "Report 2" .AddItem "Report 3" .AddIt
I am using WordPress with the advanced custom fields plugin. This is a PHP based question because these get_field() fields contain object arrays. $gallery_location = get_field('gallery_location'); $gallery_studio = get_field('gallery_studio'); For example $gallery_location when dumped will return this: array(18) { [0]=> array(10) { ["id"]=> int(126) ["alt"]=> string(0) "" ["title"]=> string(33) "CBR1000RR STD Supersport 2014 001" ["caption"]=> string(0) "" ["description"]=> string(0) "" ["mime_type"]=> string(10) "image/jpeg" ["url"]=> string(94) "http://www.example.com/wp/wp-content/uploads/2
I am trying to create subversion repository mirror in a remote server using "svnsync" through command line and the actual repo is located in different remote server.I am able to access this repo from SVNSLIK, but not able to connect subversion of windows compatible command: svnsync init file:///repository http://repoURL/trunk/repoName --source-username AAA --source-password PWD Authentication realm: XXX Username: AAA Password: PWD Again asked username and password, even i entered correct authentication info, thrown error. Error: svnsync:E215004:Unable to connect to a repository at URL http://r
I'd like to have a text input with a "model" as placeholder let say for an telephone number. So the text input prompts a model like ____/______ but when the users starts typing, the place holder stays like this 0124/5_____ and only underscores could be replaced. How could I achieve this? Thanks in advance
I have Anaconda 1.6.2, which uses Python 2.7.5, installed on a Windows 7 64-bit system. I need to install Pygame 1.9.1 and this is not part of the conda repository. I cannot run the Windows installer because Anaconda has not made registry entries for Python and the .msi does not recognize the Python version. So, I tried to install Pygame from source. What I originally wanted to do was create a conda package as per the instructions here http://www.continuum.io/blog/conda As per those instructions, the package (pygame in this case) is first installed from source and then a conda package is creat
I am not getting the current user name and id by this method why is anything wrong in it. $().SPServices({ operation: "GetUserInfo", async: false, userLoginName: $().SPServices.SPGetCurrentUser(), completefunc: function (xData, Status) { $(xData.responseXML).find("User").each(function() { curUserId = $(this).attr("ID"); curUserName = $(this).attr("Name"); curFullUserName = $(this).attr("ID")+";#"+$(this).attr("Name"); }); } }); alert(curUserId);
In my application(server) I create a Hibernate session in the beginning of request processing using "sessionFactory.openSession()". I retrieve the object make some changes to it in some other class and then do a saveOrUpdate as follows: Session session = sessionFactory.getCurrentSession(); Transaction dbTransaction = session.getTransaction(); dbTransaction.begin(); session.saveOrUpdate(entity); dbTransaction.commit() I have also set the below property in the configuration file. <property name="hibernate.current_session_context_class">thread</property> However when I do a session.saveOrUpdate(e
This is the [Files] portion of my code so far: [Files] Source: "other_installer.exe"; DestDir: "{app}" Source: "myprogram.exe"; DestDir: "{app}" Source: "data.dat"; DestDir: "{app}" Source: "otherdata.dat"; DestDir: "{app}" My program is dependent on another program to run. I've included the installer for this program ("other_installer.exe") in my installer. What I would like to do is launch this installer as soon as it has been copied, before continuing with "myprogram.exe" and the rest. I've googled and found the documentation for BeforeInstall in the Inno Setup Help, but they don't have an
I have a company GitHub account and I want to back up all of the repositories within, accounting for anything new that might get created for purposes of automation. I was hoping something like this: git clone [email protected]:company/*.git or similar would work, but it doesn't seem to like the wildcard there. Is there a way in Git to clone and then pull everything assuming one has the appropriate permissions?