on-internet

Resource for local cuisines and specialties across Japan

I'm wondering if there's some website that's like a "Foodie's Guide to Japan", or maybe a "Foodie Wiki" covering the whole world including Japan, etc. I know there are lots of special local dishes all over Japan, many of them are seasonal, only on one mountain or island, etc. Usually I've found out about these by chance if they happened to be mentioned in a Wikivoyage or Wikipedia article on a prefecture or town, or if I'm somewhere in Japan and a friend says "This dish is very famous from here", or sometimes from looking at what's being sold at Service Areas and Michi-no-ekis along expressway

Join the discussion →

How to avoid HTTP error 429 (Too Many Requests) python

I am trying to use Python to login to a website and gather information from several webpages and I get the following error: Traceback (most recent call last): File "extract_test.py", line 43, in <module> response=br.open(v) File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 203, in open return self._mech_open(url, data, timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line 255, in _mech_open raise response mechanize._response.httperror_seek_wrapper: HTTP Error 429: Unknown Response Code I used time.sleep() and it works, but it see

Join the discussion →

How to set max scroll position?

Let's say that we have body width of page set to 2000px with content centered horizontally inside of body with width set to 1200px. <body> <div class="content"></div> </body> CSS: body { width: 2000px; } .content { position: relative; width: 1200px; margin-left: auto; margin-right: auto; } What I am trying to achieve is that I do not allow horizontal scrolling at all until your window size is 1200px or less (on resize) with setting overflow-x to hidden. $(function() { $(window).resize(function() { if(window.innerWidth > 1200) { $("body").css({ "overflow-x": "hidden" }); } else { $("body").css(

Join the discussion →

java.lang.IllegalArgumentException: attempt to create delete event with null entity

Cann't delete/update items from database.This exception is coming when try to delete item And this form get a combo box value from MainCategory class and having a foreign key of MainCtegory.Is that the reason that not allow to delete/update. package com.auction management.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @

Join the discussion →

Resizing Image and fit it to the Canvas size

Can anyone help me to resize the image using ImageTk? I have a canvas and I will put pictures there. I have different kinds of pictures = different sizes for all pictures And when I attach the picture (just one) in the canvas, I want the picture's size to resize so that it will fit in the canvas and it will still maintain its proportion. Please help me! I am new in PIL, Tkinter,and Python. Update: I tried using thumbnail under Image but in resizing: self.image.thumbnail(self.picsize,Image.ANTIALIAS) the image is not fitting the canvas size and if the image is longer/wider than the canvas, it i

Join the discussion →

Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'

Hi I have an invalid sql statement error. This is my code: Imports System.Data.OleDb 'For OleDbConnection Imports System.Data 'For ConnectionState Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click '1 declare the variables Dim strName As String = txtName.Text Dim strAddress As String = txtAddress.Text '2. creates a new connection to your DB. Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;D

Join the discussion →

What can cause Chrome to give an net::ERR_FAILED on cached content against a server on localhost?

I'm building a web server and trying to test things. The server is running on localhost:888, and the first time I load the web app, everything works. But if I try to reload the page, a bunch of XmlHttpRequest requests fail with net::ERR_FAILED. By putting breakpoints in the server code, I can verify that the requests are never actually coming in. This isn't a connection failure, as the connection succeeds the first time. The fact that it succeeds once and then fails later implies that it might be caching-related, but there's nothing in the server code that sets the cache-control header. So I t

Join the discussion →

Use BeyondCompare to see difference between files in GIT

Before I commit my changes, I want to see the difference using BeyondCompare in GIT. How can I configure BeyondCompare to see difference in my files. I looked at this link but it did not help. BeyondCompare is installed at this location in my system: C:\program files\Beyond Compare\BCompare.exe I ran following two commands: git config --global merge.tool bc git config --global mergetool.bc.path "C:\program files\Beyond Compare\BCompare.exe" I am using GIT on Windows 7. Thanks !!

Join the discussion →

How to display data in textbox using MS Access database

I'm trying to display user data from a database into a textbox so that the user can edit/update that data later. I'm getting an error: no value has been set for at least one of the required parameters. I did not write the SELECT * FROM, because I'm not displaying data like AdminRights. Can you please help me fix the error? This is my code: private void refresh_Click(object sender, RoutedEventArgs e) { if (!isPostBack) { DataTable dt = new DataTable(); con.Open(); OleDbDataReader dr = null; OleDbCommand cmd = new OleDbCommand("SELECT [Name], [LastName], [UserName], [Password], [Address], [Email

Join the discussion →

Form and designer files not linking in Solution Explorer

I can't seem to get the form and the designer files to link in my project. They look like this in the Solution Explorer. I have excluded the files from the project and then tried including them back in the project, but this didn't work. Below is the designer code and a snippet of the forms code in case there is something in there. public partial class FormPrompt { private Button ButtonOk; private Container Components; private Label LabelPleaseEnter; private Label LabelPrompt; private TextBox TextBoxData; private void InitializeComponent() { this.LabelPleaseEnter = new Label(); this.LabelPrompt

Join the discussion →

How to move database and attach it to SQL Server 2008

I am not able to attach a database to a SQL Server 2008 on different machine. I moved the .mdf and .ldf files after detaching the database from one computer to another. When I try to attach the database on new machine the database does not show up on the file location. If I browse manually I can see the files (.mdf and .ldf). There are no hidden files under the MSSQL > DATA folder which contains all the other database files. Also is there a way to backup the database, move it to new machine and add under SQL Server? If yes then how can I do so? Please advise.

Join the discussion →

C++ random function not random

In my c++ code I have a problem. My random drawBlock function which should return xRandom and yRandom is not so random. void Game::drawBlock() { int xRandom, yRandom; std::cout<<time(NULL) << std::endl; xRandom = (rand () % 620) + 1; yRandom = (rand () % 440) + 1; std::cout << "x: " << xRandom << std::endl; std::cout << "y: " << yRandom; mBlock.setSize(sf::Vector2f(20,20)); mBlock.setPosition(xRandom,yRandom); mBlock.setFillColor(sf::Color::Red); } so what basically happens is that the first random number, in this case xRandom isn't really random. When I run the program everything seems fine x

Join the discussion →

Input array is longer than the columns in this table

I have a csv_log_reader: DataTable csvData = new DataTable(); try { using (TextFieldParser csvReader = new TextFieldParser(csv_file_path)) { csvReader.SetDelimiters(new string[] { "," }); csvReader.HasFieldsEnclosedInQuotes = true; string[] colFields = csvReader.ReadFields(); foreach (string column in colFields) { DataColumn datecolumn = new DataColumn(column); datecolumn.AllowDBNull = true; csvData.Columns.Add(datecolumn); } while (!csvReader.EndOfData) { string[] fieldData = csvReader.ReadFields(); // Making empty value as null. for (int i = 0; i < fieldData.Length; i++) { if (fieldData[i] =

Join the discussion →

Encrypting Django User Model Fields

Is there any way Django provides us to Encrypt all / atleast fields like first_name, last_name, email_id of auth.User model just like how it does encrypts PASSWORD field before storing it into Database ? My Workaround: I have gone through documentation & few questions on StackOverflow, according to which it would be possible to inherit default BaseUser model & define our own myUser model the way we want, by defining the Custom Character Field which encrypts & decrypts characters. Problem with this is in my application, I have provided SEARCH option for easy access of fields which are character

Join the discussion →

What is Python built-in function "compile" used for?

I came across a built-in function compile today. Though i read the documentation but still do not understand it's usage or where it is applicable. Please can anyone explain with example the use of this function. I will really appreciate examples. From the documentation, the function takes some parameters as shown below. compile(source, filename, mode[, flags[, dont_inherit]])

Join the discussion →

Using Sqoop to import data from MySQL to Hive

I am using Sqoop (version 1.4.4) to import data from MySQL to Hive. The data will be a subset of one of tables, i.e. few columns from a table. Is it necessary to create table in Hive before hand. Or importing the data will create the name specified in the command if it is not in the Hive?

Join the discussion →

Can I send a memorystream to an HTML element on an ASP.NET webpage?

Is it possible to send a memorystream like a file to an HTML <embed> The idea is not creating a file in the hard drive. I have created the stream and I can download the file no problem, the problem is passing to the variable to send to the aspx page so I can use it to show the file on a particular div. Is it possible without creating a file in the disk? This is the Code I have: public string ExportMemoryPdf(DataTable dtpdf, String Path) { string User = System.Web.HttpContext.Current.User.Identity.Name.ToString(); string Date = DateTime.Now.ToString(); string Year = DateTime.Now.ToString("yyyy"

Join the discussion →

How to display a custom Dialog box at a specific position?

I have a Button whose click pops up a dialog box.The dialog box is getting displayed at center.But i want to display it just below the button.How to do this ? I tried using popup window also.Here is the code private void showPopup(final Activity context, Point p) { Display display = getWindowManager().getDefaultDisplay(); width = display.getWidth(); // deprecated height = display.getHeight(); // deprecated int popupWidth =width; int popupHeight =height; // Inflate the popup_layout.xml LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.popup); LayoutInflater layoutInflater = (Lay

Join the discussion →

JButton with both ActionListener / MouseListener

Is it possible to create a Jbutton with both an ActionListener and MouseListener Meaning so i create a button and then when i press it ( throught actionListener) it changes the frame so that AFTER then button was pressed i can press anywhere on the frame and MouseListener would in use. JButton button = new JButton();//Creates Button button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //Insert MouseListener //Then do something with mouseListener } }); Heres the curent code: however they're now in sync when i try to click the button and i cannot call mous

Join the discussion →

Adding highscores to java game - From console to JPanel - Saving highscore in encrypted text file

I am new to Java, and learning new things everyday. English is not my mother language, I'm sorry. So, I'm making a maze game in Java to learn while writing code. For my maze game, the player needs to get to the exit of the maze asap. And the time he has, needs to be saved in an encrypted text file. So I've got a package Highscores combining several classes. The code works more or less, it outputs in the console. Now what I need is that that output gets outputted on a JPanel next to my maze. I've added some extra info in the code Here is my highscore class: public class Highscore { // An arrayl

Join the discussion →

JDBC Oracle Thin ORA-02396 Connection idle timeout

I am supporting some legacy code and it's chugged along fine until recently. I am looking for if there is a setting for JDBC Oracle thin connection where I can specify idle timeout via Java (no connection pooling)? A lot of resources online refer to connection pooling... is it even possible in my case (to specify idle timeout, in a non-pooling situation)? Or is idle time a setting on the specific DB user account? Updates + Questions I was able to log in as the user, and ran a query to try to find out resource limits. select * from USER_RESOURCE_LIMITS; However everything came back "UNLIMITED".

Join the discussion →

View holder OnClickListener event issue

I am creating a listview adapter with view holder : final ViewHolder holder; if (convertView == null) { convertView = layoutInflater.inflate(R.layout.activity_list_layout, null); holder = new ViewHolder(); //Layout Code here convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } setting Onclick Listener : holder.view.setOnClickListener(titleListener); final OnClickListener titleListener = new OnClickListener() { @Override public void onClick(View v) { holder.view.setBackgroundResource(R.drawable.top_bar); notifyDataSetChanged(); } }; Inside the Onclick listner, I ch

Join the discussion →

Parenting and deparenting game objects

I'm implementing a wall climbing system into my 2D game and I'm stuck on a few of the trickier parts. My thinking is that I would have my player parent to the wall object when it collides with the 2D collider attached. When the player collides with the wall, the player becomes a child of that wall and is limited to only moving up and down on the wall. When the player jumps, or reaches the top, they are no longer a child of the wall. But the player has the ability to jump on any point onto the wall they land on and stays at that point. Right now I have the parenting part worked out with the fol

Join the discussion →

Bit hacking and modulo operation

While reading this: http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith64BitsDiv I came to the phrase: The last step, which involves modulus division by 2^10 - 1, has the effect of merging together each set of 10 bits (from positions 0-9, 10-19, 20-29, ...) in the 64-bit value. (it is about reversing the bits in a number)... so I did some calculations: reverted = (input * 0x0202020202ULL & 0x010884422010ULL) % 1023; b = 74 : 01001010 b * 0x0202020202 : 1000000010000000100000001000000010 = 9494949494 :01001010010010100100101001001010010010100 & 10884422010 :100001000100001000100

Join the discussion →

How to configure deployment from Eclipse to Wildfly

When I deploy app using jboss-as-maven-plugin mvn clean jboss-as:deploy application works. When I try to deploy from Eclipse using e.g. "Full publish", it doesn't. I've compared versions of application being deployed and seems that "Full publish" simply copied what has been specified in Properties > Deployment Assembly. Is it possible to use this plugin during "Full publish" ? I want to make use of hot deploy feature for jsp, but without properly configured automatic deployment from Eclipse I'm rather blocked. regards Lukas Wildfly 8.0.0.CR1 Eclipse Keppler SR1 org.jboss.as.plugins:jboss-as-ma

Join the discussion →

inherit is not defined

I'm studying a JavaScript book, and I have this example var p = { // x and y are regular read-write data properties. x: 1.0, y: 1.0, // r is a read-write accessor property with getter and setter. // Don't forget to put a comma after accessor methods. get r() { return Math.sqrt(this.x * this.x + this.y * this.y); }, set r(newvalue) { var oldvalue = Math.sqrt(this.x * this.x + this.y * this.y); var ratio = newvalue / oldvalue; this.x *= ratio; this.y *= ratio; }, // theta is a read-only accessor property with getter only. get theta() { return Math.atan2(this.y, this.x); } }; var q = inherit(p);

Join the discussion →

Tools to convert pdf table to something usable

Are there any tools/libraries available (in linux) to help convert a pdf table to something usable, such as csv? Take for example http://www.sendspace.com/file/dkoq5j . Here is a picture of the page too. I could just type it out of course which might be quickest but I thought it would be interesting to see what can be done automatically. pdftotext extacts the text but just puts everything in a column like this. School name Admission number per year Abacus Argyle Beckford [...] pdftotext -layout is actually pretty good.

Join the discussion →
Older stories