on-internet

Android downloading file through DownloadManager not working correctly

I'm trying to download files thru DownloadManager, it works perfectly on most of the phones (Nexus family, S3, etc) but on Galaxy S2 for some reason the download works, but the name of the file is set wrong and when I try to open it (either from notification, either downloads app) it says that the file cannot be opened, even for files like jpeg, gif, png, etc. Here is the code: DownloadManager downloadManager = (DownloadManager) service .getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request downloadReq = new DownloadManager.Request( Uri.parse(URL)); downloadReq .setAllowedNetwork

Join the discussion →

SELECT only the qualifying values from nominated columns with CodeIgniter's query builder to populate an autocomplete field with options

I am trying to write server-side scripting for an AJAX process which fetches the values from specific columns matching a search term. Unfortunately, my code returns all column values for each row which contains a match in any of the searched columns. This is problematic because I only want to collect the unique column values which are LIKE the search term. It will be unhelpful to use the non-matchong results in the autocomplete feature. How can I achieve what I need? My controller: function suggestions() { $this->load->model('Booksmodel'); $term = $this->input->post('term',TRUE); $rows = $this

Join the discussion →

how to write full text search in codeigniter

i have written a method and model for keyword search. But unfortunately I am getting the output which are matched with my keyword and also which does not have any match with the keyword I typed. Here is My Code: controller.php : function suggestions() { $this->load->model('Booksmodel'); $term = $this->input->post('term',TRUE); $rows = $this->Booksmodel->GetAutocomplete(array('keyword' => $term)); $json_array = array(); foreach ($rows as $row) array_push($json_array, $row->book_title); array_push($json_array, $row->auth_firstname); array_push($json_array, $row->isbn); echo json_encode($json_arr

Join the discussion →

Spring how to reload the values from application.properties at runtime

In my Spring application I load application.properties file from outside the application e.g. /user/home/properties/application.properties. The values in the file are injected via @Value annotation in the beans. The new requirement I've is to be able to change values in application.properties file and reload (or reinject) the new values in the beans. Is something like this possible in Spring 3.2?

Join the discussion →

How to check if a variable is a typed array in javascript?

I'm working on a game and we make extensive use of typed arrays (Float32Arrays) for our math types. We save and load the gamestate from JSON. An example of JSON stringify output is for such an array (in Chrome) is: "{"0":0,"1":0,"2":0,"length":3,"byteLength":12,"byteOffset":0,"buffer":{"byteLength":12}}" This wastes space and causes them to be loaded as objects which is inconvenient. Ideally we could use the stringify 'replacer' function to test if a variable is a typed array, and then convert it to a bog standard array in that case. Unfortunately I'm not sure how to reliably test whether a va

Join the discussion →

How to use Oracle CTE for such query?

I have a query that looks like following: SELECT m.Name, (m.Value + NVL(a1.Value1, 0) + NVL(a2.Value2,0) + NVL(a3.Value3,0) "Value" FROM m MainTable LEFT JOIN Additional1 a1 ON (...) LEFT JOIN Additional2 a2 ON (...) LEFT JOIN Additional3 a3 ON (...) WHERE (conditions on m) ORDER BY 1; These query produces multiple rows for each Name. I need to limit it to one row for each Name with the following logic: include the row which Value is the closest to the average Value for a given Name. Something tells me that CTE should allow for a more compact code and hopefully more effective implementation, s

Join the discussion →

How do I auto-expand a JTree when setting a new TreeModel?

I have a custom JTree and a custom JModel; I would for the JTree to "auto-expand" when I give it a new model. At the moment, it simply collapse all the nodes to the root. Here is an example: private class CustomTree extends JTree { @Override public boolean isExpanded(TreePath path) { return ((Person) path.getLastPathComponent).hasChildren(); } private class CustomTreeModel extends TreeModel { // ... omitting various implementation details @Override public boolean isLeaf(Object object) { return !((Person) object).hasChildren(); } } Model model = new Model(); Person bob = new Person(); Person al

Join the discussion →

Android - Is there is a way to remotely open and debug a given Android device?

My scenario is as follow: I'm working with an app development which a bug occurs in the app when it is in a different country than mine, and only there. The bug is related with a fail in an image download through an URL access. Right now, I haven't figured out yet what it can be. Some subjects I've already looked up are: Its not related to internationalization and/or culture, because the code does not implement this; Its not related to firewall/security access, because if the user in the other country opens the image's URL, he can look at the image; Without rooting the device, is there is a wa

Join the discussion →

Using ajax/jQuery Form Validation on ASP.NET controls

Good Day I am using an ASP.NET page with a master page. I want to do live form validation on the input fields (). Now all the tuts and demos/plugins I have seen are using normal html labels. I tried to implement some of them on my form, but they are not working. (I am using a mater page and a normal aspx web form...) UPDATE: Issue replacing input tags with asp controls for the password fields... The original input elements <fieldset> <legend>Validating a complete form</legend> <p> <label for="firstname">Firstname</label> <input id="firstname" name="firstname" type="text" /> </p> <p> <label for

Join the discussion →

Invalid null character in text to output

I'm trying to pass some data process in the server side to the client through my WS. But I'm getting this error: SEVERE: caught throwable javax.xml.ws.WebServiceException: com.ctc.wstx.exc.WstxIOException: Invalid null character in text to output at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:112) at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:278) at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:380) at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:92) at com.sun.xml.ws.transport.http.HttpAdapt

Join the discussion →

Colorbox "This content failed to load." error

I need to load a subscription form with colorbox on page load.Colorbox opens on page load but inside I only see an error message "This content failed to load.". Here is the code that I use JS jQuery(document).ready(function($) { $('.colorbox5').colorbox({open:true, href:'div#content5'}); }); .... HTML <body> <div style="display:none;"> <div id="content5" class="colorbox5"> ... my form here </div> </div> Can anybody please help me to solve this problem? (I'm using Drupal)

Join the discussion →

Connect to self-signed SSL website via Apache JMeter

I try to do a performance test on a website that uses a self-signed SSL certificate. My JMeter test plan works correct on a "usual" SSL site (with correctly signed certificate) and on the test page without SSL. As soon as I access the test page (using a self-signed cert) JMeter only creates errors. What I have tried: Stored the certificate (via Browser) and imported it into Java (via Control Panel "Java") Added the certificate to a keystore and started JMeter via the following commmand line (I have no other idea how to "reference the keystore in the JVM" in another way?!) java -jar "ApacheJMet

Join the discussion →

easy way to cleanly dump contents of associative array in bash?

In zsh I can easily dump the contents of an associative array with a single command: zsh% typeset -A foo zsh% foo=(a 1 b 2) zsh% typeset foo foo=(a 1 b 2 ) However despite searching high and low, the best I could find was declare -p, whose output contains declare -A: bash$ typeset -A foo bash$ foo=([a]=1 [b]=2) bash$ declare -p foo declare -A foo='([a]="1" [b]="2" )' Is there a clean way to obtain something like the zsh output (ideally foo=(a 1 b 2 ) or foo='([a]="1" [b]="2" )'), preferably without resorting to string manipulation?

Join the discussion →

Recordset in asp and execute stored procedure in asp

I want to open another .asp page from one .asp page on button click following is the code i have done but error is coming Error is coming as "operation is not allowed when the object is closed" Here is the code Dim dbconn, objCmd, objParam, rs, EmailID, Password, connString, RecordCount connString = "Connectionstring" dbconn = Server.CreateObject("ADODB.Connection") dbconn.Open(connString) rs = Server.CreateObject("ADODB.RecordSet") objCmd = Server.CreateObject("ADODB.Command") objCmd.ActiveConnection = dbconn objCmd.CommandText = "sp_Name" objCmd.CommandType = &H0004 objParam = objCmd.CreateP

Join the discussion →

localhost not opening website

I created a blank Web App in ASP.NET on Visual Studio 2012. When I click on Debugging using Google Chrome, Google chrome opens with text localhost on the navigation bar, but it does not open the website and keeps loading.

Join the discussion →

ListBox and Item Values - Visual Basic 2010

I am writing a small application using VISUAL BASIC 2010 (It came packaged in Visual Studio 2010). I have a list box set up to be populated by an Access database. The database has two columns: 1) Variable Name 2) Description. As an example to be used in my question, here is a sample of my data: Variable Name Description DOG1 Dog Species that came from Family 1 Now, I have a list box that is populated by the Description column. This is what I need. I want to click a button and then depending on which item is clicked, display its corresponding "Description" in a textbox. This pertains to I belie

Join the discussion →

Excel 2013: multiple pivot tables on one sheet below each other

I need to create a dashboard with multiple pivot tables in the same Excel sheet, one below the other. The problem is that when the pivot table refreshes it may be longer (more rows) so it gives a warning that the rows below what it needs will be overwritten. I'd like to know how to configure Excel pivot table for adding rows in pivot table without overwriting the following. I have already seen an example when Microsoft Techdays 2013 but I cannot remember the method. (There is a check box to enable in Excel 2013)

Join the discussion →

How to determine a call made is local or STD OR ISD

I am developing an application which requires to keep track of the outgoing calls made by user, which I am able to track by Using Broadcast Receiver. I also want to detect that is that call is Local or STD or ISD, but I am not able to detect that.

Join the discussion →

How to run and debug JBoss EAP 6 from Eclipse?

I installed JBoss EAP 6.01 on my local computer, and JBoss tools in my eclipse (Juno), I try to access JBoss and debug from within my eclipse, I follow the new server wizard to create and configure sever in eclipse, see attached images: I then tried to start the server, however, I got error connecting to jmx for JBoss Runtime Server Can anyone help me figure out why? Thanks a lot!

Join the discussion →

Delete old entries of the event-log with PowerShell?

I'd like to delete old entries of the event-log (where old means "older that X days") using PowerShell. I found the Clear-EventLog cmdlet but that Deletes all entries from specified event logs on the local or remote computers. I have found a lot of scripts that use this cmdlet to delete ALL entries - but is there a way to select only some [old] entries of the event-log and delete only those?

Join the discussion →

Sending SMS through GSM modem to mobile phone

Using VB.NET I need to send a SMS using GSM modem to a mobile phone. Currently I have the following code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If serialport.IsOpen Then serialport.Close() End If Try With serialport .PortName = ComboBox1.Text .BaudRate = 96000 .Parity = Parity.None .DataBits = 8 .StopBits = StopBits.One .Handshake = Handshake.RequestToSend .DtrEnable = True .RtsEnable = True .NewLine = vbCrLf End With serialport.Open() Catch ex As Exception End Try serialport.WriteLine("AT+CMGF=1" & vbCr) System.Threading.Th

Join the discussion →

What is the pythonic way to access nested dicts without NoneType errors?

I have a deep nested dict (decoded from JSON, from the Instagram API). My initial code was like this: caption = post['caption']['text'] But that would throw a NoneType or KeyError error if the 'caption' key or the 'text' key doesn't exist. So I came up with this: caption = post.get('caption', {}).get("text") Which works, but I'm not sure about the style of it. For instance, if I apply this technique to one of the deeper nested attributes I'm trying to retrieve, it looks pretty ugly: image_url = post.get('images',{}).get('standard_resolution',{}).get('url') Is there a better, more pythonic, way

Join the discussion →

Java Swing: Add tabs into JPanels

I have a series of tabs, but I want to then add further tabs within the panel it displays, as if to replicate a ribbon menu. I roughly know what needs to be done (changing the return type of the makeTextPanel function) but don't know how to so any help would be appreciated. package components; import javax.swing.JTabbedPane; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.JComponent; import javax.swing.SwingUtilities; import javax.swing.UIManager; import java.awt.BorderLayout; import java.awt.Dimension; import ja

Join the discussion →

"market://details?id=" says item not found

I am trying to add rating feature in my app https://github.com/codechimp-org/AppRater but, the every time I click on the rate now it says The item you requested could not be found. How do I get out of this trouble. I am using public void onClick(DialogInterface dialog, int id) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri .parse("market://details?id=com.xxx.xxx")));

Join the discussion →

VBScript error 424 Object Required when running script under SYSTEM account

I am trying to add a domain user account to a local group and everything works fine if I am logged into the computer but if I run the same script under the SYSTEM account it fails with the error: 424 Object Required". Here is the code: Dim domain : domain = "DOMAIN01" Dim domainController: domainController = "99.139.151.102" Dim localComputer : localComputer = "SERVER001" Dim localGroup : localGroup = "LocalGroup1" Dim domainAccount : domainAccount = "User1" Dim objLocalGroup Dim objDomainUser Set objLocalGroup = GetObject("WinNT://" & localComputer & "/" & localGroup & ",group") Set objDomain

Join the discussion →

Game Engine as EXE and Game as DLL?

Hi guys I'm starting the design of a new little game engine and I was assuming the game engine as a DLL and then build a project for the game that would use this DLL and output an EXE file. But then I read about the latest ID Tech Game Engines and how they do it the other way around. (http://fabiensanglard.net/doom3/index.php) It's not really explained why though. I have the feeling it has something to do with modding as only the Game (DLL in this case) was open to the public for quite some time while the Engine (EXE) was closed source. But I would like to know if there are other reasons for t

Join the discussion →

How to deploy swing application on web browser?

I have a big swing application that I have developed. There are several classes that each creates its own JFrame while closing the previous one which called this class. I wish to deploy this into a web browser and understand that I need to convert it to an applet. Do I have to add in code for creating applet in each of these classes? or is there some other way. In my current situation each of the class creates a JFrame which has some buttons which on being clicked will close the current JFrame and instantiate a new class which creates another JFrame. Could you please help me and advice me on h

Join the discussion →
Older stories