on-internet

FAILED CONFIGURATION: @BeforeMethod setUp java.lang.NoClassDefFoundError: com/google/common/base/Function

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

Join the discussion →

Making specific code lines invisible in IDE (preferably eclipse)

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

Join the discussion →

Android App Not Install. An existing package by the same name with a conflicting signature is already installed

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?

Join the discussion →

SQL Server: Create index on view

I created view on table and I'd like to create index on this view. When I created index only on view my query doesn't use index but when I create index on table and next the same index on view, query use index. My view is creating new column based on other column with the same table which is based my view so I can't create index on table because i can't modify this table. It is possible created non clustered index on view which can improve my query? When I created non clustered index my query only table scan instead of use non clustered index.

Join the discussion →

How can I insert image and text into a Microsoft Word template?

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

Join the discussion →

chi-square as scoring function for regression

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 ?

Join the discussion →

Removing last comma from a foreach loop [duplicate]

I'm using a foreach loop to echo out some values from my database and separating each of them by commas. I don't know how to remove the last comma it adds on the last value. My code is pretty simple, but I just can't seem to find the correct way of doing this: foreach ($this->sinonimo as $s){ echo '<span>'.ucfirst($s->sinonimo).',</span>'; }

Join the discussion →

jQuery select2 get value of select tag?

Hello friends this is my code: <select id='first'> <option value='1'> First </option> <option value='2'> Second </option> <option value='3'> Three </option> </select> This is my select2 code: $("#first").select2(); Below is code for getting selected value. $("#first").select2('val'); // It returns first,second,three. This is return a text like first,second,three and I want to get 1,2,3. Means I need the value of select box, not text.

Join the discussion →

C# ZipArchive.CreateEntryFromFile() does not add file from disk to archive

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?

Join the discussion →

Python: How do i store a text input from the user on Tkinter?

This is what i tried so far to get the user's input: master = Tk() master.title('Title') v = StringVar() L1 = Label(master, text = 'Name') L1.pack(side = LEFT) E1 = Entry(master, textvariable = v, bd = 5) E1.pack(side = RIGHT) def userinput(): a = raw_input(v.get()) print a b = Button(master, text = 'Submit', command = userinput) b.pack(side = BOTTOM) master.mainloop() The real question is, how can i store the v.get() raw_input into a variable outside the function? Thx!

Join the discussion →

How to call destructor after response in php?

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"; } }

Join the discussion →

Java calculator giving weird results

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

Join the discussion →

Prevent duplicates from adding items from Listbox1 to Listbox2

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

Join the discussion →

array_merge() returns null if one or more of arrays is empty?

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

Join the discussion →

Not able to access svn repo located in a remote server from different remote server with subversion

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

Join the discussion →

getting exception Authentication failed for token submission in apache shiro

i am new in apache shiro.i am getting exception when i execute this statement. currentUser.login(token); exception is errororg.apache.shiro.authc.AuthenticationException: Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - [email protected], rememberMe=true]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException). i am invoking this method for login.the code is. public boolean authorize(String username,String password) { Boolean status=false; log.debug("the user id "+username+"passwrodD::"+password); Realm

Join the discussion →

Text input with placeholder staying when typing

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

Join the discussion →

Installation of pygame with Anaconda

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

Join the discussion →

get current logged user name & its ID in sharepoint 2010 using jquery

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);

Join the discussion →

maps.googleapis result is different from maps.google.com

I have a very weired problem with maps: When I search maps.google.com for 'rue du sapin, la marsa, tunisie' it finds it and works as expected. Now I'm using the Api and I configured it this way private static final String MAPS_REQUEST_URL = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=FR&components=country:TN&address="; When I request this url with 'rue du sapin, la marsa, tunisie' it returns Rue du Sapin, Carthago, Tunisie I tried to play with the region, language, country parameters but nothing makes it work: it seams Google is translating la marsa to cartahago (in

Join the discussion →

"org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions" even when the context is Thread

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

Join the discussion →

Inno Setup: Install other installer and run it before continuing my install

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

Join the discussion →

How to clone all repos of a Github account at once?

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?

Join the discussion →

Swing - Custom scrollbar

I'm currently working on a project on java Swing. I need to make my custom scrollbar. I couldn't find a good tutorial on how to make one. Can anyone help me? Anything will be much apreciated. Cheers :) José. PD: I want the scrollbar to have this looks:

Join the discussion →

RegularExpressionValidator for US phonenumber ASP.net

I am having an issue using the RegularExpressionValidator using Visual Studio 2010. This is my code: <asp:Label ID="phone" runat="server" Text="Phone Number"></asp:Label><asp:TextBox ID="phonebox" runat="server" TextMode="Phone"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Invalid Number" ControlToValidate="phonebox" ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"></asp:RegularExpressionValidator> <br /> No matter what number I type in, I get an error message beside the field - even if I copy and paste a valid US phone

Join the discussion →

How to keep input placeholder visible when user is typing

I have a new and intriguing requirement. Instead of the placeholder disappearing when the user starts typing, it should remain visible and shift over to the right hand side of the input box. Is this even possible with a standard HTML placeholder? How might I achieve this? Thanks

Join the discussion →

How to use DISTINCT in a SELECT query built with CodeIgniter's active record methods

$q = $this->db ->select(' books.title, reserved_books.id, reserved_books.isbn, reserved_books.price, reserved_books.item_sold, reserved_books.date_sold, reserved_books.total_amount ') ->from('reserved_books') ->join('books', 'reserved_books.isbn= books.isbn') ->limit($limit, $offset); How can I use distinct here in my query? reserved_books.isbn is the unique one.

Join the discussion →

HOW to add histo in ROOT-framework?

i choose to ask a question here well aware that i can infringe some rules of StackExchange maybe becouse this isn't the right place to ask that, but i saw a lot of question related to CERN ROOT. I know that here people that answer the questions prefer to show the way instead to give a cooked solution, but i need some help and i have no time to learn from the answers, i only want a solution for my problem. I apologize in advance! Here is my problem: i have two .root files: one of a spectrum ("sezione_misura_90.root"), one from background ("sezione_fondo_90.root"). I have to subtract the second

Join the discussion →

Non-Greedy Regular Expression Matching in Flex

I have just started with Flex and can't seem to figure out how to match the following Expression : "Dog".*"Cat" ------------------ Input : Dog Ca Cat Cc Cat ------------------ Output: Dog Ca Cat Cc Cat But I want a non-greedy matching, with the following output : Output: Dog Ca Cat How can this be acheived on Flex ? EDIT Tried the following : %% Dog.*Cat/.*Cat printf("Matched : ||%s||", yytext); dog.*cat printf("Matched : ||%s||", yytext); dOg[^c]*cAt printf("Matched : ||%s||", yytext); DOG.*?CAT printf("Matched : ||%s||", yytext); %% Input : Dog Ca Cat Cc Cat dog Ca cat Cc cat dOg Ca cAt Cc c

Join the discussion →

Android unzip open failed: ENOENT (No such file or directory)

I am using the following code to unzip a set of files (containing folders as well): private boolean unpackZip(String path, String zipname) { InputStream is; ZipInputStream zis; try { String filename; is = new FileInputStream(path + zipname); zis = new ZipInputStream(new BufferedInputStream(is)); ZipEntry ze; byte[] buffer = new byte[1024]; int count; while ((ze = zis.getNextEntry()) != null) { // zapis do souboru filename = ze.getName(); // Need to create directories if not exists, or // it will generate an Exception... if (ze.isDirectory()) { File fmd = new File(path + filename); fmd.mkdirs()

Join the discussion →
Older stories