Daily Archives

Articles indexed Friday December 14 2012

Page 4/17 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Array comparion for multidimensinal array in php

    - by Learner
    Array 1 = pr($plan_data); Array ( [0] => Array ( [AveragePrice] => 9.631161 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161456 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Savings Champ-6 [PlanId] => 57 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1058 [PlanRate] => 9.3 [PlanRenewablePercent] => 7.2 [PlanTerm] => 6 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161456 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161456 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) [1] => Array ( [AveragePrice] => 10.1311693 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161458 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Savings Champ-12 [PlanId] => 59 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1060 [PlanRate] => 9.8 [PlanRenewablePercent] => 7.2 [PlanTerm] => 12 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161458 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161458 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) [2] => Array ( [AveragePrice] => 10.4311743 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161459 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Green Power-12 [PlanId] => 60 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1061 [PlanRate] => 10.1 [PlanRenewablePercent] => 100 [PlanTerm] => 12 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161459 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161459 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) ) Array 2 = pr($temp_val); Array ( [0] => Array ( [id] => 6 [PlanId] => 60 [PlanName] => Bounce 12 + A/C Protection [PlanDescription] => Bounce 12 + A/C Protection - CNP [PlanTerm] => 12 [PlanRate] => [RateId] => [PlanIssueDate] => [PlanMonthlyFee] => [EarlyTerminationFee] => 200.00000 [AveragePrice] => 12.00000 [HurricaneRecovery] => [PlanRenewablePercent] => [ProviderDisplayName] => [ProviderId] => 1 [provider] => bounce [ProductZoneId] => 353 [Zone] => 77479 [ProviderInternalName] => [RegularMoveIn] => [PriorityMoveIn] => [OffCycle] => [TDSPPassThrough] => [PUCAssessment] => [EFLUrl] => [EFLLinkUrl] => http://www.bounceenergy.com/efls/bounce12.pdf [TOCUrl] => [TOCLUrl] => http://www.bounceenergy.com/terms-of-service-fixed.pdf [YRACUrl] => [YRACLUrl] => http://www.bounceenergy.com/yraac.pdf [REP_Name] => [REP_PUCT] => [customer_service_email] => [toll_free_number] => [status] => active [created] => 2012-12-14 12:40:05 [modified] => 2012-12-14 ) [1] => Array ( [id] => 18 [PlanId] => 17 [PlanName] => Online Only - 12 [PlanDescription] => Online Only - 12 [PlanTerm] => 12 [PlanRate] => [RateId] => 386 [PlanIssueDate] => [PlanMonthlyFee] => 100.00000 [EarlyTerminationFee] => 175.00000 [AveragePrice] => 10.00000 [HurricaneRecovery] => [PlanRenewablePercent] => [ProviderDisplayName] => [ProviderId] => 2 [provider] => fulcrum [ProductZoneId] => [Zone] => 77479 [ProviderInternalName] => [RegularMoveIn] => [PriorityMoveIn] => [OffCycle] => [TDSPPassThrough] => [PUCAssessment] => [EFLUrl] => [EFLLinkUrl] => [TOCUrl] => [TOCLUrl] => [YRACUrl] => [YRACLUrl] => [REP_Name] => [REP_PUCT] => [customer_service_email] => [toll_free_number] => [status] => active [created] => 2012-12-14 12:40:15 [modified] => 2012-12-14 ) ) I want to compare this two array and if any key value is different i want to take it an different array.. $result_val= array_diff_assoc($plan_data, $temp_val); Please help me out !!

    Read the article

  • Using stored procedures to generate RDLC report in C#

    - by NDraskovic
    I'm making an application that generates reports for my client. I'm using his database that contains stored procedures which return the data needed for the reports. The problem is that I don't know how to execute them from the application (more specific the TableAdapter in my dataset). When I use the visual aid to create the TableAdapter, it shows the error "Invalid object named #table1". This is weird because there is a temporary table called #table1 in the stored procedure. When I try to do the whole job programmatically, I get the exception Incorrect syntax near '.'. An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name. I created a DataTable that has identical structure as the result of the stored procedure, but I still get the same exception

    Read the article

  • Codeigniter HTML & Apache, JPG & jpg

    - by romme86
    Hi i'm using codeigniter to save some jpg/JPG files on the webserver. The problem is i don't know if all of the files extension will be the same: jpg/JPG so on rendering i put a tag like this <img src="/.../name.JPG"/> in this way if the uploaded file is a .jpg it will not be displayed. the solution i'm going to use is a simple redundance of the tag HTML: <img src="/.../name.JPG"/> <img src="/.../name.jpg"/> this way if one is not rendered the other is i would like to know if this problem can be resolved in php or codeigniter by changing the file extension on upload.

    Read the article

  • HTML/Javascript disabled and then reenabled checkbox is being POSTED

    - by NeverStopLearning
    I have a page with a checkbox that is disabled/reenabled with javascript on button click. If I never disable the checkbox then its value is correctly POSTed, however if I disable the checkbox even once it gets posted without value (posts as "name=" even when checked). I have inspected the POST value through firebug. Why does it behaves like this? Am I missing something? I ve read somewhere that disabled controls are not posted, thats OK, but this control is not disabled when the submit is clicked. I am using ASP.NET with more complex setup to test this, but essentially this is the core of the problem. The brower is FF latest. I found very similar question, however without an answer: disabled control being reenabled but still not posting back contents to server

    Read the article

  • JQuery div tag has children in FireFox but not Chrome

    - by John Edwards
    I am using JQuery ajax to load images from a url, display them, and then place a button on top of each image. The code works in firefox, but in chrome, the div parent "photos" that should have all the children(one child div "photo" for each image received from the url) is 0. I have tried read() and load(), but nothing seems to work. If I run alert($('#photos').children().size()); in the Chrome console it returns the children. But at execution it returns 0. Any ideas? $(window).load(function () { $("p").text("The DOM is now loaded and can be manipulated."); //returns 0 in chrome, but 10 in firefox alert($('#photos').children().size()); $('#photos').children().each(function() { //do stuff

    Read the article

  • installing widgets for qt

    - by Lakshan Perera
    I resently found a very useful set of widgets set for qt from http://www.wysota.eu.org/wwwidgets/ and I downloaded wwWidgets 1.0 installer for MinGW and simply installed it. now I can see those widgets in qt creator, and I can drag and drop them. but when compiling the project it says that those include files are not found. (ex: qwwled.h not found) but I see that file is in C:\Qt\4.8.3\include\wwWidgets please if someone can help me in this issue I would be very thankful. im using qt 4.8.3 with mingw 4.4

    Read the article

  • didFinishLaunchingWithOptions not called

    - by user1256477
    I'm having trouble enabling push notifications. with this code I try to enable the notification: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; return YES; } It doesnt work, so I added a breakpoint in the line [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; But it seems this part of the code is never execute. why is this not working?

    Read the article

  • How is it possible my array is broken?

    - by user1812765
    I have this piece of code: public lot merge (lot otherlot){ wafer[] mWaferarray = new wafer[16]; byte[] bytearray = new byte[16]; wafer resultwafer = new wafer(bytearray); wafer w1; wafer w2; int i; int[][] assignmentmatrix = HungarianAlgorithm.computeAssignments(convertinttofloat (solutionmatrix(otherlot))); for (i=0; i != assignmentmatrix.length ;i++){ w1 = otherlot.getWaferarray()[assignmentmatrix[i][0]]; w2 = getWaferarray()[assignmentmatrix[i][1]]; resultwafer.setWafer(w1.wafercompare(w2)); mWaferarray[i] = resultwafer; mWaferarray[i].print(); } System.out.println("HERE\n"); mWaferarray[5].toString(); resultlot = new lot(mWaferarray); resultlot.print();// Problem occurs here. return resultlot; } As you can see I create an array of wafers (selfdefined class). Then I fill this up with new wafers. When I print this array (mWaferarray[i].print()) it gives me the wanted results. But when I go out of the "for"-loop the array is broken and it is as if the last item I add to mWaferarray fills it up (the entire array, 16 long, is filled with this wafer). So if run this program this is what I get: 1011110010111100 0011011111111110 0111110111101101 1010111001101111 0110110111101111 1010110101111010 1010110111011110 1011111010111100 1111110011101110 0111111111011011 1111111111011010 1101111011111010 1010110101011110 0101111011011010 1011111011011000 0101111011011010 HERE 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 0101111011011010 As you can see it is as if the array is filled with the last wafer. I have been looking at this for some time now, I hope you guy can help me out. Thx in advance PS: my print functions are written like this: void print(){ int j; for (j=0; j != waferarray.length ;j++){ waferarray[j].print(); } } EDIT: added code for lot this is the beginning of the lot class public class lot { wafer[] waferarray = new wafer[16]; lot resultlot; public lot (wafer wafer1,wafer wafer2,wafer wafer3,wafer wafer4, wafer wafer5,wafer wafer6,wafer wafer7,wafer wafer8, wafer wafer9,wafer wafer10,wafer wafer11,wafer wafer12, wafer wafer13,wafer wafer14,wafer wafer15,wafer wafer16){ waferarray[0] = wafer1; waferarray[1] = wafer2; waferarray[2] = wafer3; waferarray[3] = wafer4; waferarray[4] = wafer5; waferarray[5] = wafer6; waferarray[6] = wafer7; waferarray[7] = wafer8; waferarray[8] = wafer9; waferarray[9] = wafer10; waferarray[10] = wafer11; waferarray[11] = wafer12; waferarray[12] = wafer13; waferarray[13] = wafer14; waferarray[14] = wafer15; waferarray[15] = wafer16; } public lot (wafer[] thiswaferarray){ waferarray = thiswaferarray; }

    Read the article

  • How to execute query with empty fields?

    - by Kliver Max
    I have a SQL Query: SELECT documents.*, t_rights.rights, documents_list.docs FROM documents INNER JOIN t_rights on t_rights.num=documents.type_right INNER JOIN documents_list on documents_list.num=documents.document1 WHERE code_document=1 or code_document=1 In case if i have fields documents.document1 and documents.document1 with some value all works fine. But if this field empty i get empty query result. Its possible make query like this with empty fields?

    Read the article

  • Nullable enum in html helper

    - by Fabien Piron
    I have a view model that contains enum with nullable type like this one : public StudyLevel? studyLevel { get; set; } I have made custom html helper to display a dropdownlist for rendering the enum into the view, the nullable case is displayed using <option value="null">No value</option> the problem is that when i submit the form modelstate give me the error : studylevel cannot be "null" . Could you suggest me any way to help me handle the nullable type in the view ?

    Read the article

  • Ajax not working in visual studio 2005

    - by sachin
    I am trying to do an ajax website, but my ajax is not working. I checked my GAC and system.web,extensions dll is available. Why it is not working .? I am also not getting any errors. I tried many ways. I wrote the below code to test ajax. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"> </cc1:CalendarExtender> </div> </form> </body> </html> JAvascript error that i got 1.Type is not defined http://localhost:1467/testnew/Default.aspx?_TSM_HiddenField_=ToolkitScriptManager1_HiddenField&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d1.0.20229.20821%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3ac5c982cc-4942-4683-9b48-c2c58277700f%3ae2e86ef9%3aa9a7729d%3a9ea3f0e2%3a9e8e87e9%3a1df13a87%3a4c9865be%3aba594826%3a507fcf1b%3ac7a4182e

    Read the article

  • Returning a static array without using a class field

    - by Bart Friederichs
    I have the following base and derived (partial, for sake of brevity) classes: class Base { public abstract int[] someArray { get; } } class Derived : Base { private readonly static int[] _someArray = new int[] { 1,2,3,4 }; public override int[] someArray { get { return _someArray; } } } What I would like now, is put the new int[] { 1,2,3,4 } in the return part of the getter. But, that would create a new array every time the getter is called. Is it possible to directly return some kind of object, which stays the same for all objects of class Derived ? Something along the lines of (I know this is invalid C#): get { return (int[]) { 1, 2, 3, 4 }; }

    Read the article

  • Efficiently generate numpy array from list comprehension output?

    - by shootingstars
    Is there a more efficient way than using numpy.asarray() to generate an array from output in the form of a list? This appears to be copying everything in memory, which doesn't seem like it would be that efficient with very large arrays. (Updated) Example: import numpy as np a1 = np.array([1,2,3,4,5,6,7,8,9,10]) # pretend this has thousands of elements a2 = np.array([3,7,8]) results = np.asarray([np.amax(np.where(a1 > element)) for element in a2])

    Read the article

  • php mysql_fetch_array() error

    - by user1877823
    I am getting this error while i am trying to delete a record the query is working but this line remains on the page. i want to echo "Deleted" written in the while should show up but the while loop is not working, i have tried and searched alot nothing helps! mysql_fetch_array() expects parameter 1 to be resource, boolean given in delete.php on line 27 delete.php <html> <body> <form method="post"> Id : <input type="text" name="id"> Name : <input type="text" name="name"> Description : <input type="text" name="des"> <input type="submit" value="delete" name="delete"> </form> <?php include("connect.php"); $id = $_POST['id']; $name = $_POST['name']; $des = $_POST['des']; $result = mysql_query("DELETE FROM fact WHERE id='$id'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "Deleted"; } mysql_close($con); ?> </body> </html> connect.php <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Dataentry", $con); ?> How should i make the while loop work..

    Read the article

  • word after the space NSlog

    - by DD007
    I am new bie to xcode may be question is silly but I am lagging with my home work. In a file I want to read a specific character after the string. I want to read all the character after the space. ex: asasasasasas wewewewewewe qwqwqwqwqwqw xyz_ 22 aaaaaaaaaaa bbbbbbbbbbb ccccccccccccccc ddddddddddddd fgfgfgfgfgfgfg ererererererer abc_ 12 bbbbbbbbbb dddddddd jkjkjkjkjkjkjk lalallalalalal everything is fine .. but i want to print after "xyz_ 22" as aaaaaaa then bbbb ccc

    Read the article

  • How can I allocate 8 GB ( not 1 GB ) RAM to my JDK on windows

    - by Deepak
    JDK on Windows takes max around 2 GB RAM. Even if we allocate more RAM to our JDK; it doesnt take it. If I need to run a process which need 8 GB RAM on Windows; how can I achieve it ? Do we have any JDK provided by any other provider which could support it ? Memcached provides us additional cache which can be used... but that is not I am looking for. Suppose I need to run my jMeter with 8 GB RAM on my windows box; Memcached wont help for sure.. Is there any provider which provides me with this ? Previosly I thought Terracotta does that; but looks like that also is like Memcached. I am using Windows 7. If needed I can use Windows Server also.. I just need to get it running.

    Read the article

  • App closes after facebook login in IOS 5

    - by Aromal Sasidharan
    I am using facebook sdk 3.1 framework for my application. The login process works successfully and returns to the app after facebook login both in simulator(iOS 6.0 and 5.0) and in iPad(iOS 6). But When the same is deployed in IPad with IOS 5, after login, it does not return back to my application and shows a blank white Screen or sometimes my application closes. I dont know what went wrong in iOS 5 and facebook sdk 3.1 framework, also i am not getting any logs to debug... Please help Iam using this code for login NSArray *permissions = [[NSArray alloc] initWithObjects: //@"user_likes", //@"read_stream", @"publish_stream", @"user_events", @"read_friendlists", @"user_birthday", @"email", nil]; [FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES completionHandler: ^(FBSession *session, FBSessionState state, NSError *error) { NSLog(@"state %d", state); [self sessionStateChanged:session state:state error:error]; }];

    Read the article

  • Listener error not connecting

    - by Sham
    I have two database running on Port No : 1521. When i m connecting to ORCL db it get's connected, but when i try to connect to another DB it gives me following error. ORA-12514: TNS:listener does not currently know of service requested in connect descriptor. My Listener: # listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0 \dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. ADMIN_RESTRICTIONS_LISTENER = ON LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.1.1.1)(PORT = 1521)) ) ) ADR_BASE_LISTENER = C:\app\Administrator TNSNAMES.ora ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.1.1.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) PARIVARTAN = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.1.1.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = Parivartan) ) ) Lsnrctl Result STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production Start Date 14-DEC-2012 14:22:51 Uptime 0 days 0 hr. 19 min. 31 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File C:\app\Administrator\product\11.2.0\dbhome_1\network\a dmin\listener.ora Listener Log File c:\app\administrator\diag\tnslsnr\127.1.1.1\listener\al ert\log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.1.1.1)(PORT=1521))) Services Summary... Service "orcl" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclXDB" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully Reply me soon....

    Read the article

  • How do I make this Java code operate properly? [Multi-threaded, race condition]

    - by Fixee
    I got this code from a student, and it does not work properly because of a race condition involving x++ and x--. He added synchronized to the run() method trying to get rid of this bug, but obviously this only excludes threads from entering run() on the same object (which was never a problem in the first place) but doesn't prevent independent objects from updating the same static variable x at the same time. public class DataRace implements Runnable { static volatile int x; public synchronized void run() { for (int i = 0; i < 10000; i++) { x++; x--; } } public static void main(String[] args) throws Exception { Thread [] threads = new Thread[100]; for (int i = 0; i < threads.length; i++) threads[i] = new Thread(new DataRace()); for (int i = 0; i < threads.length; i++) threads[i].start(); for (int i = 0; i < threads.length; i++) threads[i].join(); System.out.println(x); // x not always 0! } } Since we cannot synchronize on x (because it is primitive), the best solution I can think of is to create a new static object like static String lock = ""; and enclose the x++ and x-- within a synchronized block, locking on lock. But this seems really awkward. Is there a better way?

    Read the article

  • Converting a C++ Checksum function to Java

    - by user1897599
    I'm trying to convert this C++ checksum to Java but for the time being I've failed. What am I doing wrong? What is it supposed to do? It is supposed to return a positive checksum for a buffer in OpenGL Here's the C part. DWORD QuickChecksum(DWORD *data, int size){ if(!data) { return 0x0; } DWORD sum; DWORD tmp; sum = *data; for(int i = 1; i < (size/4); i++) { tmp = data[i]; tmp = (DWORD)(sum >> 29) + tmp; tmp = (DWORD)(sum >> 17) + tmp; sum = (DWORD)(sum << 3) ^ tmp; } return sum; } And here is what I have tried in Java. As far As I know DWORD is 32bit so I use int in a long to get a unsigned int which should be done in java with ? I've been looking at this problem so much now that I've grown blind to it. public static long getChecksum(byte[] data, int size) { long sum, tmp; sum = getInt(new byte[]{data[0], data[1], data[2], data[3]},true) & 0xFF; for(int I = 4; I < data.length; I += 4) { tmp = getInt(new byte[]{data[I],data[I+1],data[I+2],data[I+3]},true) & 0xFF; tmp = (sum >>> 29) + tmp; tmp = (sum >>> 17) + tmp; sum = (sum << 3) ^ tmp; } return sum & 0xFF; } private static int getInt(byte[] bytes, boolean big) { ByteBuffer bb = ByteBuffer.wrap(bytes); return bb.getInt(); } Thank you all for your help!

    Read the article

  • How do I make a script that properly introduces hstore in both 9.0 and 9.1?

    - by Igor Zinov'yev
    I am trying to introduce the hstore type into the database of a project I'm developing. But the problem is that I have a slightly newer version of the Postgres server installed on my development machine than there is on the production machine. While I can simply execute the CREATE EXTENSION command locally, this command is unavailable on the production machine. Is there a way to create a script that will install hstore both on 9.1 and 9.0?

    Read the article

  • boost::spirit::karma using the alternatives operator (|) with conditions

    - by Ingemar
    I'm trying to generate a string from my own class called Value using boost::spirit::karma, but i got stuck with this. I've tried to extract my problem into a simple example. I want to generate a String with karma from instances of the following class: class Value { public: enum ValueType { BoolType, NumericType }; Value(bool b) : type_(BoolType), value_(b) {} Value(const double d) : type_(NumericType), value_(d) {}; ValueType type() { return type_; } operator bool() { return boost::get<bool>(value_); } operator double() { return boost::get<double>(value_); } private: ValueType type_; boost::variant<bool, double> value_; }; Here you can see what I'm tying to do: int main() { using karma::bool_; using karma::double_; using karma::rule; using karma::eps; std::string generated; std::back_insert_iterator<std::string> sink(generated); rule<std::back_insert_iterator<std::string>, Value()> value_rule = bool_ | double_; Value bool_value = Value(true); Value double_value = Value(5.0); karma::generate(sink, value_rule, bool_value); std::cout << generated << "\n"; generated.clear(); karma::generate(sink, value_rule, double_value); std::cout << generated << "\n"; return 0; } The first call to karma::generate() works fine because the value is a bool and the first generator in my rule also "consumes" a bool. But the second karma::generate() fails with boost::bad_get because karma tries to eat a bool and calls therefore Value::operator bool(). My next thought was to modify my generator rule and use the eps() generator together with a condition but here i got stuck: value_rule = (eps( ... ) << bool_) | (eps( ... ) << double_); I'm unable to fill the brackets of the eps generator with sth. like this (of course not working): eps(value.type() == BoolType) I've tried to get into boost::phoenix, but my brain seems not to be ready for things like this. Please help me! here is my full example (compiling but not working): main.cpp

    Read the article

  • All MySQL Databases lost overnight

    - by Iain
    After a call from a customer to say that his website is down, I find that MySQL on our RackSpace Cloud Windows 2008 server was not running. I restarted MySQL but got the 'Access denied for user' error in the browser for all websites with MySQL database. When I look in MySql Server 5.5/data there are no folders other than mysql and performance_schema. It appears all the databases and data have been wiped. Does anyone know what might have happened and where the data has gone? To top that I just found this server is missing from our backup service. ps appears to be after windows update at 4:01 this morning.

    Read the article

  • "The server closed the connection without sending any data"

    - by Toby
    Server setup The problem Diagnostic information What I've tried Specific Help needed 1. I have the following server setup: Debian Squeeze Linux 2.6.32-5-amd64 Apache2-mpm-prefork 2.2.16-6+squeeze10 PHP 5.3.3-7+squeeze14 This server is protected with the Suhosin Patch 0.9.9.1 Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 300 - Keep-Alive: 15 Loaded Modules core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_auth_digest mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_rewrite mod_setenvif mod_ssl mod_status Wordpress 3.4.2 (Upgrading to 3.5 soon :) 2. The problem When I restart the server (sudo shutdown -r now), going to any website page results in the following error from the web browser (in this case, Google Chrome, but other browsers also show the same error). This error can also occur an hour or so after all is working ok, seemingly randomly, which is my biggest concern as it means my server is not reliable: No data received Unable to load the web page because the server sent no data. Here are some suggestions: Reload this web page later. Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. 3. Diagnostic information The apache error log contains the folowing entries: [Fri Dec 14 22:23:27 2012] [notice] child pid 1955 exit signal Floating point exception (8) [Fri Dec 14 22:23:27 2012] [notice] child pid 1956 exit signal Floating point exception (8) [Fri Dec 14 22:23:29 2012] [notice] child pid 1957 exit signal Floating point exception (8) [Fri Dec 14 22:23:30 2012] [notice] child pid 1958 exit signal Floating point exception (8) [Fri Dec 14 22:23:32 2012] [notice] child pid 1959 exit signal Floating point exception (8) [Fri Dec 14 22:23:32 2012] [notice] child pid 1960 exit signal Floating point exception (8) [Fri Dec 14 22:23:34 2012] [notice] child pid 1961 exit signal Floating point exception (8) [Fri Dec 14 22:23:34 2012] [notice] child pid 1962 exit signal Floating point exception (8) 4. What I've tried a) I can 'fix' the website temporarily by resetting the server twice (resetting it once does not work) using the following commands. NB: the 'reload' option does not work, I have to use restart twice. However, the error can reoccur sometime later. sudo /etc/init.d/apache2 restart sudo /etc/init.d/apache2 restart b) I have tried disabling suhosin by uninstalling php5-suhosin, but a php info page still shows "This server is protected with the Suhosin Patch 0.9.9.1". I have tried putting Suhosin into simulation mode by creating a file /etc/php5/apache2/conf.d/suhosin.ini containing: [suhosin] suhosin.simulation = On The php info page shows the suhosin.ini file in the list of "Additional .ini files parsed" but the php info page still shows "This server is protected with the Suhosin Patch 0.9.9.1" c) Increasing the PHP memory limit In /etc/php5/apache2/ : ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 512M d) Disabling all Wordpress plugins, and going back to the default theme. 5. Specific help needed I would very much like help in debugging what is going on here. I am not sure how to determine what processes are in the Apache error log which are exiting "[notice] child pid 1955 exit signal Floating point exception (8)", or what is causing them to exit. And whether suhosin is part of the problem (and how to disable it if it is). Thank you in advance for any advice or tips you can offer in helping me debug this.

    Read the article

  • Using AWS SES with Sendmail

    - by Abs
    I am trying to send mail via AWS SES uisng Sendmail. I have Sendmail version 8.14.4 installed and I followed the first section of this useful tutorial by Amazon. However, I get this: root@:/etc/mail# echo "Subject: test" | sendmail -v [email protected] [email protected]... Connecting to [127.0.0.1] via relay... [email protected]... Deferred: Connection timed out with [127.0.0.1] Can anyone help me get this working? The logs have the following: Dec 14 10:35:21 ip-10-xx-xx-181 sm-msp-queue[17910]: qBE8K1Lu016411: to=root, delay=00:21:24, xdelay=00:06:19, mailer=relay, pri=121806, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >