on-internet

How to open Default Browser settings from my android application?

As per my requirement I have to clear default browser cache from my application. I want to open browser settings from my application, so that user can clear the cache. By using following code. startActivityForResult(new Intent(android.provider.Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS), 0); I'm able to open all manage applications. Is there any way to open browser settings directly? Thanks

Join the discussion →

Datatransfer in Chrome

I am implementing dragging an image from thumbnail and dropping into a canvas and draw it. I have used datatransfer.setdata() during the event ondragstart and datatransfer.getdata() on event ondrop. It is working perfectly in Firefox, but doesn't work in Chrome. I have come to know that in Chrome datatransfer is not supported. So, what can be a good solution, that should be cross browser compatible too! function dragIt(event) { event.dataTransfer.setData("URL", event.target.id) }; function dropIt(event) { var theData = new Image(); theData = event.dataTransfer.getData("URL"); dt = document.get

Join the discussion →

getting exception: The Network Adapter could not establish the connection in simple jdbc program

I was trying to run a simple jdbc code [ using jdk 1.6, oracle 10g] as, package javaapplication2; import java.text.*; import java.sql.*; import java.io.FileWriter; import java.io.PrintWriter; import java.io.BufferedWriter; /** * @author animark */ public class CallableStatementEx1 { public CallableStatementEx1(){;} public static void main(String s[]) throws Exception { try { Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); Connection con=null; String url= "jdbc:oracle:thin:@//localhost:1521:orcl" ; con = DriverManager.getConnection(url,"scott","password"); String query="update e

Join the discussion →

How to edit data in GridView using asp.net MVC?

I am binding data to the gridview from SQL server but having some issues with the Edit. Here is my model code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Data.Entity; namespace Gridview_BugTracker.Models { public class BugTracker_DataHelper { public static List<BugTracker_DataHelper> GetList{get;set;} public string ProjectId { get; set; } public string projectName { get; set; } public string Description { get; set; } public string status { get; set; } } } Here is my controller code using Syst

Join the discussion →

Android change PDF pages in PDF Viewer

I need to use PDF-Viewer in my app. I took many APIs as a reference but I'm still stuck in viewing PDF files from SDCARD. Here is my code: First.java public class First extends ListActivity { String[] pdflist; File[] imagelist; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); File images = Environment.getExternalStorageDirectory(); imagelist = images.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return ((name.endsWith(".pdf"))); } }); pdflist = new String[imagelist.length]; for (in

Join the discussion →

Android-Code to Implement PDF Viewer

Here i need to use Pdf-Viewer in my app.i took many API as a reference but still stucking up in viewing Pdf files from SDCARD. here my code `First.java public class First extends ListActivity { String[] pdflist; File[] imagelist; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); File images = Environment.getExternalStorageDirectory(); imagelist = images.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return ((name.endsWith(".pdf"))); } }); pdflist = new String[imagelist.length]; for (

Join the discussion →

Crystal Reports: suppress details sections conditional on page number

I have a Crystal Reports question on suppressing different details sections, appreciate any help you could give. I have 2 details sections, A and B, and I want detailsA to show only on page 1 and detailsB to show only on page 2, but I can't get it to work using conditional suppressing. For detailsA I suppressed based on the following formula: if pagenumber = 1 then formula = false else formula = true end if And similarly for the detailsB. But when I then go to print this, it only shows page 1 (with detailsA only), it doesn't print a page 2. How do I force page 2 to also print? (by the way, I'm

Join the discussion →

ActionScript 3 - Resize a MovieClip dynamically by browser BUT keep PROPORTIONS

I have a Movie Clip with dimensions: 500x400. Instance name is: "main". I have the following code: import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.events.Event; stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; stage.addEventListener (Event.RESIZE, resizeHandler); // initialize sizing resizeHandler (null); function resizeHandler (event:Event):void { var sw:Number = stage.stageWidth; var sh:Number = stage.stageHeight; main.height = sh; main.width = sw; } How can I keep proportions on resizing and maximum size for MovieClip to be 500

Join the discussion →

how to create an asp button dynamically and add event to it

I'm trying to create a button dynamically on asp.net,but I can't add the event to it.What is wrong or missing below? Thanks in advance $ Button btn2 = new Button(); btn2.ID = "btnEdit"; btn2.Text = "Edit Member"; btn2.Click += new EventHandler(btnEdit_Click); form1.Controls.Add(btn2); I also tried like this: $ Button btn2 = new Button(); btn2.ID = "btnEdit"; btn2.Text = "Edit Member"; btn2.Attributes.Add("OnClick","btnEdit_Click); form1.Controls.Add(btn2);

Join the discussion →

Consistency: Dividing an integer by the powers of 2 vs powers of 10?

This is a question concerning cross-platform consistency and determinism of floating point operations (IE yield different results on different CPUs/sysetms) Which one is more likely to stay cross-platform consistent(pseudo code): float myFloat = float ( myInteger) / float( 1024 ) or float myFloat = float ( myInteger ) / float( 1000 ) Platforms are C# and AS3. . AS3 versions: var myFloat:Number = myInteger / 1000 // AS3 var myFloat:Number = myInteger / 1024 // AS3 - Ok I've added AS3 version for clarification, which is equivalent to the 'C pseudo code' above . As you can see in AS3 all calculat

Join the discussion →

Connection timeout with HttpURLConnection in Groovy

I am always getting the "Error Connecting to ${url}" message? Can anyone please show me my mistake? def url = new URL("https://www.google.com") HttpURLConnection connection = (HttpURLConnection) url.openConnection() connection.setRequestMethod("GET") // connection.setConnectTimeout(10000) connection.connect() if (connection.responseCode == 200 || connection.responseCode == 201) { def returnMessage = connection.content //print out the full response println returnMessage } else { println "Error Connecting to " + url } | Error 2012-07-05 00:04:05,950 [http-bio-8080-exec-6] ERROR errors.GrailsExce

Join the discussion →

How to make a table row unclickable in jquery datatable?

Am using jQuery Datatables for listing of the users, and using the selectable property to select and unselect rows. Now I have a issue that I want to make one row non clickable (i.e. the row of logged in user)... how can I do that ..Any help will be appreciated $('#example tr').click( function() { } How can I disable this function for a particular row?

Join the discussion →

GridView VS GridLayout in Android Apps

I have to use a Grid to implement Photo Browser in Android. So, I would like to know the difference between GridView and GridLayout. So that I shall choose the right one. Currently I'm using GridView to display the images dynamically.

Join the discussion →

Wordpress Pagination for single.php

I've implemented category-based numeric pagination in my Wordpress theme: What I've done so far is create a custom page template with a list of paginated excerpts. Once a user clicks on an excerpt to view the full article I'd also like to paginate the list of returned articles displayed. It's my understanding that this is achieved in the theme's 'single.php', though I may be wrong. The pagination works for my custom template, but when I try implementing the custom query within single.php I think the pagination attempts to find the next page within the article itself, which is not what I'm tryi

Join the discussion →

Always block does not synthesize

I just want to use some if/else statement in Verilog. So I have to use always block. integer count, index; reg a = 0; always @(a) begin a = 1; for (count=0; count<7; count=count+1) begin index = 4*count; if ((significand[index]==1'b0) &&(significand[index+1]==1'b0) && (significand[ind‌​ex+2]==1'b0) && (significand[index+3]==1'b0)) lzero=lzero+1; end end This code does make some sense now. I was able to get the correct simulation result, but I failed to get the correct synthesis on the board.

Join the discussion →

Equal in if statement not working as expected

use Text::Diff; my $count; our $stats2 = 0; for ($count = 0; $count <= 1000; $count++){ my $data_dir = "archive/oswiostat/oracleapps.*dat"; my $data_file = `ls -t $data_dir | head -1`; chomp($data_file); while (defined($data_file)){ print $data_file; open (DAT, $data_file) || die("Could not open file! $!"); my @stats1 = stat $data_file; my @raw_data = <DAT>; close(DAT); print "Stats1 is :$stats1[9]\n"; sleep(5); print "Checking $stats1[9] equals $stats2\n"; if (chomp($stats1[9]) != chomp($stats2)) { print "I am here"; my @diff = diff \@raw_data, $data_file, { STYLE => "Context" }; print @diff

Join the discussion →

Tomcat work directory has to be cleared periodically

we got a problem with our Tomcat that non of my colleagues can really explain. We have a tomcat (version 7.0.26) on a linux computer. The deployment is done with an exploded war - our classes are jar packaged, the rest goes directly into WEB-INF and META-INF). Plus there is a CMS server that generates JSP files wich are deployed periodically into the tomcat web app. After some time of hot swapping, creating and deleting JSP files, the tomcat does some weird stuff. Randomly giving out 404 errors or publishing old versions, sometimes the latest versions and so on. To solve that, we have to clear

Join the discussion →

MySQL connections from PHP on IIS?

I have inherited a web site that is in PHP and we are mostly a Windows shop. I cannot get the PHP code to connect to MySQL at all. 1 - The IDE is Eclipse. I imported the project and set up a debug configuration and everything works fine there with HTML and other PHP (non DB) code. 2 - I am running IIS 7.5 with PHP enabled 3 - I have tried to connect to two completely separate MySQL instances (different hosts, different DBs, etc) and it will not connect I have already made sure that sql.safemode is turned to OFF and there is no default server in php.ini (that shouldn't come into play if safe mo

Join the discussion →

hibernate not-null property references a null or transient value:

This problem appears randomly. Program has worked well for over a month and today it crashed. While adding a new order the user can choose a company from the dropdown list. Then he can save new order to the database. It works most of the times even now when a reloaded the app. The error code is as follows: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: mapped.Order.company (odwzorowania.Zlecenie.firma) Using Hibernate, JSF 2.1, MySql 5.5, javax.persistence.* here is the code (names are translated from polish

Join the discussion →

PHP/Codeigniter - MySQL error on fulltext search?

I'm trying to perform a fulltext search with codeigniters built in Active Record methods. I had a "custom" query string before that i pretty much copied into codeigniter code (so to speak). Somewhere in the where statement there's an error, but i can't find it. $this->db->select('movies.*'); $this->db->from('movies'); $this->db->join('movies_genres', 'movies.id = movies_genres.movie_id', 'left'); $this->db->join('genres', 'movies_genres.genre_id = genres.id', 'left'); $this->db->where('MATCH (movies.movie_title) AGAINST (`'.$query.'`) IN BOOLEAN MODE', null, false); //$this->db->group_by('movi

Join the discussion →

FAIL - Encountered exception org.apache.catalina.LifecycleException

I am unable to deploy .war on Tomcat 7. It is working fine on one of the servers but not working on the other. Following is the error that I get. FAIL - Encountered exception org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AppAPIs]] Following are the content of catalina.out WARNING: Failed to retrieve JNDI naming context for container [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AppAPIs]] so no cleanup was performed for that container javax.naming.NameNotFoundException: Name comp is not b

Join the discussion →

How to find the size of an array in postgresql

Is there any way to find a size of an array? For Example, CREATE TABLE example (id integer[]) ; INSERT INTO example VALUES ( '{}'); INSERT INTO example VALUES ( '{5,6,7}'); From this, is there any possibilities to get a result like following, size --- 0 3

Join the discussion →

Can one partially apply the second argument of a function that takes no keyword arguments?

Take for example the python built in pow() function. xs = [1,2,3,4,5,6,7,8] from functools import partial list(map(partial(pow,2),xs)) >>> [2, 4, 8, 16, 32, 128, 256] but how would I raise the xs to the power of 2? to get [1, 4, 9, 16, 25, 49, 64] list(map(partial(pow,y=2),xs)) TypeError: pow() takes no keyword arguments I know list comprehensions would be easier.

Join the discussion →

Does Python have a built-in function for unindenting a multiline string?

Say I have the string s = """ Controller = require 'controller' class foo view: 'baz' class: 'bar' constructor: -> Controller.mix @ """ Every line in the string now has a global 4 space indentation. If this string was declared inside a function, it would have a 8 space global indentation, etc. Does Python have a function for removing the global left indentation of string? I would like that function output to be: Controller = require 'controller' class foo view: 'baz' class: 'bar' constructor: -> Controller.mix @"

Join the discussion →

Why does InetAddress.getLocalHost().getHostName() return a value different from bash "hostname"?

I've got a build.gradle task that works like a champ on my dev box at producing a properties file that records the name of the machine that the build was generated on. The logic is simple enough... def hostname = InetAddress.getLocalHost().getHostName(); On my dev box this always produces the same value as if I did hostname from the bash shell. bobk-mbp:DM_Server bobk$ hostname bobk-mbp.local On our jenkins CI server, however, bash hostname returns one thing, but my call to InetAddress.getLocalHost().getHostName(); returns something else. What needs to change on the jenkins machine to get thes

Join the discussion →

Pipe output from shell command to a python script

I want to run a mysql command and set the output of that to be a variable in my python script. Here is the shell command I'm trying to run: $ mysql my_database --html -e "select * from limbs" | ./script.py Here is the python script: #!/usr/bin/env python import sys def hello(variable): print variable How would I accept the variable in the python script and have it print the output?

Join the discussion →

NGINX Header and Body Filter Modules

I've been coding an NGINX filter module that can read/write cookies for incoming requests. If a particular cookie isn't set correctly (i.e. authentication cookie), it will set the outgoing header status to the appropriate error code. This works fine per the directions of Evan Miller's tutorial. The next part I'm trying to get working (and haven't thus far) is having the body filter be invoked so I can insert/replace body response text when error responses are encountered. I again followed Evan Miller's tutorial on body filters, and I cannot for the life of me get this working. Here's my setup:

Join the discussion →

Climate in Peru in September

My girlfriend and I want to travel in South America in September, and we were thinking Peru. How is the climate in Peru's interest points this time of year? What will we wear there? And also, if we're lazy and don't want to sleep outside in a sleeping bag, can we still enjoy our trip?

Join the discussion →
Older stories