Search Results

Search found 8189 results on 328 pages for 'fedora 16'.

Page 71/328 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • rake test not copying development postgres db with sequences

    - by Robert Crida
    I am trying to develop a rails application on postgresql using a sequence to increment a field instead of a default ruby approach based on validates_uniqueness_of. This has proved challenging for a number of reasons: 1. This is a migration of an existing table, not a new table or column 2. Using parameter :default = "nextval('seq')" didn't work because it tries to set it in parenthesis 3. Eventually got migration working in 2 steps: change_column :work_commencement_orders, :wco_number_suffix, :integer, :null => false#, :options => "set default nextval('wco_number_suffix_seq')" execute %{ ALTER TABLE work_commencement_orders ALTER COLUMN wco_number_suffix SET DEFAULT nextval('wco_number_suffix_seq'); } Now this would appear to have done the correct thing in the development database and the schema looks like: wco_number_suffix | integer | not null default nextval('wco_number_suffix_seq'::regclass) However, the tests are failing with PGError: ERROR: null value in column "wco_number_suffix" violates not-null constraint : INSERT INTO "work_commencement_orders" ("expense_account_id", "created_at", "process_id", "vo2_issued_on", "wco_template", "updated_at", "notes", "process_type", "vo_number", "vo_issued_on", "vo2_number", "wco_type_id", "created_by", "contractor_id", "old_wco_type", "master_wco_number", "deadline", "updated_by", "detail", "elective_id", "authorization_batch_id", "delivery_lat", "delivery_long", "operational", "state", "issued_on", "delivery_detail") VALUES(226, '2010-05-31 07:02:16.764215', 728, NULL, E'Default', '2010-05-31 07:02:16.764215', NULL, E'Procurement::Process', NULL, NULL, NULL, 226, NULL, 276, NULL, E'MWCO-213', '2010-06-14 07:02:16.756952', NULL, E'Name 4597', 220, NULL, NULL, NULL, 'f', E'pending', NULL, E'728 Test Road; Test Town; 1234; Test Land') RETURNING "id" The explanation can be found when you inspect the schema of the test database: wco_number_suffix | integer | not null So what happened to the default? I tried adding task: template: smmt_ops_development to the database.yml file which has the effect of issuing create database smmt_ops_test template = "smmt_ops_development" encoding = 'utf8' I have verified that if I issue this then it does in fact copy the default nextval. So clearly rails is doing something after that to suppress it again. Any suggestions as to how to fix this? Thanks Robert

    Read the article

  • How to read/write high-resolution (24-bit, 8 channel) .wav files in Java?

    - by dB'
    I'm trying to write a Java application that manipulates high resolution .wav files. I'm having trouble importing the audio data, i.e. converting the .wav file into an array of doubles. When I use a standard approach an exception is thrown. AudioFileFormat as = AudioSystem.getAudioFileFormat(new File("orig.wav")); --> javax.sound.sampled.UnsupportedAudioFileException: file is not a supported file type Here's the file format info according to soxi: dB$ soxi orig.wav soxi WARN wav: wave header missing FmtExt chunk Input File : 'orig.wav' Channels : 8 Sample Rate : 96000 Precision : 24-bit Duration : 00:00:03.16 = 303526 samples ~ 237.13 CDDA sectors File Size : 9.71M Bit Rate : 24.6M Sample Encoding: 32-bit Floating Point PCM Can anyone suggest the simplest method for getting this audio into Java? I've tried using a few techniques. As stated above, I've experimented with the Java AudioSystem (on both Mac and Windows). I've also tried using Andrew Greensted's WavFile class, but this also fails (WavFileException: Compression Code 3 not supported). One workaround is to convert the audio to 16 bits using sox (with the -b 16 flag), but this is suboptimal since it increases the noise floor. Incidentally, I've noticed that the file CAN be read by libsndfile. Is my best bet to write a jni wrapper around libsndfile, or can you suggest something quicker? Note that I don't need to play the audio, I just need to analyze it, manipulate it, and then write it out to a new .wav file. * UPDATE * I solved this problem by modifying Andrew Greensted's WavFile class. His original version only read files encoded as integer values ("format code 1"); my files were encoded as floats ("format code 3"), and that's what was causing the problem. I'll post the modified version of Greensted's code when I get a chance. In the meantime, if anyone wants it, send me a message.

    Read the article

  • Heroku: bash: bundle: command not found

    - by Space Monkey
    My heroku deployment is crashing with following errors. 2012-12-12T17:16:18+00:00 app[web.1]: bash: bundle: command not found 2012-12-12T17:16:19+00:00 heroku[web.1]: Process exited with status 127 2012-12-12T17:16:19+00:00 heroku[web.1]: State changed from starting to crashed The Heroku documentation for this error is to set PATH and GEM variables as described in https://devcenter.heroku.com/articles/changing-ruby-version-breaks-path I tried that, however that too is not helping. ? heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin ? heroku config:add GEM_PATH=vendor/bundle/ruby/1.9.1 ? heroku run rake db:migrate Running rake db:migrate attached to terminal... up, run.7130 bash: bundle: command not found Next, I tried setting Ruby version in my Heroku app. This increased the slugsize. But app was still not up. Gemfile ruby "1.9.2" Pushed to Heroku -----> Using Ruby version: ruby-1.9.2 -----> Installing dependencies using Bundler version 1.2.2 heroku run "ruby -v" Running `ruby -v` attached to terminal... up, run.4483 ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux] Can someone please advice

    Read the article

  • Hibernate - Problem in parsing mapping file (.hbm.xml)

    - by Yatendra Goel
    I am new to Hibernate. I have an exception while running an Hibernate-based application. The exception is as follows: 16 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA 16 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found 16 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 31 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 94 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml 94 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml 219 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : app/data/City.hbm.xml 266 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(12) Attribute "coloumn" must be declared for element type "property". 266 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(13) Attribute "coloumn" must be declared for element type "property". 266 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(14) Attribute "coloumn" must be declared for element type "property". It seems that it is not finding coloumn attribute of the property element in the mappings file but my mappings file do have the coloumn attribute. Below is the mappings file (City.hbm.xml) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="app.data"> <class name="City" table="CITY"> <id column="CITY_ID" name="cityId"> <generator class="native"/> </id> <property name="cityDisplyaName" coloumn="CITY_DISPLAY_NAME" /> <property coloumn="CITY_MEANINGFUL_NAME" name="cityMeaningFulName" /> <property coloumn="CITY_URL" name="cityURL" /> </class> </hibernate-mapping>

    Read the article

  • Count bits used in int

    - by sigvardsen
    If you have the binary number 10110 how can I get it to return 5? e.g a number that tells how many bits are used? There are some likewise examples listed below: 101 should return 3 000000011 should return 2 11100 should return 5 101010101 should return 9 How can this be obtained the easiest way in Java? I have come up with the following method but can i be done faster: public static int getBitLength(int value) { int l = 1; if (value >> 16 > 0) { value = value >> 16; l += 16; } if (value >> 8 > 0) { value = value >> 8; l += 8; } if (value >> 4 > 0) { value = value >> 4; l += 4; } if (value >> 2 > 0) { value = value >> 2; l += 2; } if (value >> 1 > 0) { value = value >> 1; l += 1; } return l; }

    Read the article

  • TSQL Help (SQL Server 2005)

    - by Mick Walker
    I have been playing around with a quite complex SQL Statement for a few days, and have gotten most of it working correctly. I am having trouble with one last part, and was wondering if anyone could shed some light on the issue, as I have no idea why it isnt working: INSERT INTO ExistingClientsAccounts_IMPORT SELECT DISTINCT cca.AccountID, cca.SKBranch, cca.SKAccount, cca.SKName, cca.SKBase, cca.SyncStatus, cca.SKCCY, cca.ClientType, cca.GFCID, cca.GFPID, cca.SyncInput, cca.SyncUpdate, cca.LastUpdatedBy, cca.Deleted, cca.Branch_Account, cca.AccountTypeID FROM ClientsAccounts AS cca INNER JOIN (SELECT DISTINCT ClientAccount, SKAccount, SKDesc, SKBase, SKBranch, ClientType, SKStatus, GFCID, GFPID, Account_Open_Date, Account_Update FROM ClientsAccounts_IMPORT) AS ccai ON cca.Branch_Account = ccai.ClientAccount Table definitions follow: CREATE TABLE [dbo].[ExistingClientsAccounts_IMPORT]( [AccountID] [int] NOT NULL, [SKBranch] [varchar](2) NOT NULL, [SKAccount] [varchar](12) NOT NULL, [SKName] [varchar](255) NULL, [SKBase] [varchar](16) NULL, [SyncStatus] [varchar](50) NULL, [SKCCY] [varchar](5) NULL, [ClientType] [varchar](50) NULL, [GFCID] [varchar](10) NULL, [GFPID] [varchar](10) NULL, [SyncInput] [smalldatetime] NULL, [SyncUpdate] [smalldatetime] NULL, [LastUpdatedBy] [varchar](50) NOT NULL, [Deleted] [tinyint] NOT NULL, [Branch_Account] [varchar](16) NOT NULL, [AccountTypeID] [int] NOT NULL ) ON [PRIMARY] CREATE TABLE [dbo].[ClientsAccounts_IMPORT]( [NEWClientIndex] [bigint] NOT NULL, [ClientGroup] [varchar](255) NOT NULL, [ClientAccount] [varchar](255) NOT NULL, [SKAccount] [varchar](255) NOT NULL, [SKDesc] [varchar](255) NOT NULL, [SKBase] [varchar](10) NULL, [SKBranch] [varchar](2) NOT NULL, [ClientType] [varchar](255) NOT NULL, [SKStatus] [varchar](255) NOT NULL, [GFCID] [varchar](255) NULL, [GFPID] [varchar](255) NULL, [Account_Open_Date] [smalldatetime] NULL, [Account_Update] [smalldatetime] NULL, [SKType] [varchar](255) NOT NULL ) ON [PRIMARY] The error message I get is: Msg 8152, Level 16, State 14, Line 1 String or binary data would be truncated. The statement has been terminated.

    Read the article

  • convert bitmap to byte array

    - by narasimha
    hi 437400a8-1-40-1-32016747073700110010100-1-370670967876987810109111322151312121327202116223229343432293131364052443638493931314561454953555858583543636863566752575855-1-37067110101013121326151526553731375555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555-1-640178010401043134021713171-1-600270103031000000000002461375-1-6004716022133244700000001234517336184919-127203465817505111366829798-111-95-79-1-600241111110000000000001234-1-6003217110222230000000001217318433506581113-95-1-380123102173170630-16-480094-43116-84-8341-30-84-72118-4865250106-2-80-97-121-2-11836-5741-108-362116-43101-966-102974345-787448-12486-1877-87316379-54-71-58112-109-116-94-98279102-97-36-767534-11711311444-57-56-82859384-100399-83-100100-68-90-114-788678118-394344-108-895754-274161-37111-53108-11938-11-2005010612210612546-764577107-107-36-1125-61-7319-78-51-109107-26-287-37-5284119-25126-26-749476-79-116115-19-107-102-7795-33-46-2402764-47-1214100-15-6-10918-105-115-127-1097069-111-123-16-50-9051-8367127-10291-65-53-78-35-18-66-36-103-6499-1099-982327-107979107-473-22-672780-23-5595-4581-4550-18-57-7598-37101-72-79-107-10885-77-39-42-92-72-114-41194622-4108-49200-29-30-8-40-8-8116-58-19114-6907-91073-6210617-101-116-10836-3882-37-122-41-97-6-120-128000-1089941-67-952339-7712337-6511-1064640000000105-11110-85-114-95-46-409042-45-24-86120-8355-10726-32-91110-5-9111-7686-33-63-54123-66-3411951024-29-29-57-11410724-74-2002764-77-127-97-107-899159112-81-9951-78-71854171-21945-92-67-478818-55102-88010000-7386116-85-45111-63-1249-2727-84-115-114-3986-99-111-19-33-120-53-24-98-4-94-9538-2-64080000-73-101-1212890-79108-1149461-18-6-677126-92-37-87-18-41108-72-31-15-65-7145-110-2484020000005949-20-12111-82-5724-53-7873-1956-8739-5-89-28852-29-61771251215652-99109-81105-38-1010261-7086-10594-97858542-278-5911146-33-10645-75-3-11843111-90-49-49-1095499-11344-78-5892-90-81-32-960-40000000090-44-79106-61-55-12-88-52-894629-111-105-8578-3-69-76-10192-8141-15-2077-5-48-86040000114-4594836411202-26-103-90102-22-7149-57-45-15-84-66-42-46645-19-5-3-118-41851012258-18-82117-393149-10090107-39-9771-89117-20-2-100-49121-685-118-68-98-5754145-4679-493031-70107-3398-10611885-103-39-73-27-35-6-105-394337-53124-73-65-43-73-289-119-33-67-33-59125105-48054-1280000011075980-53-446115-116-71-37-16-12-58-102-7373118-62622301982-35-118-962-12800015-1-39 this resultfor bytearray its not true how can implement byte array please some solution

    Read the article

  • WPF: Horizontal Alignment

    - by emptyset
    Probably I'm just missing something obvious, but I can't get the image in my DataTemplate to align to the right in the Grid, so that when the window is stretched, the image is "pulled" to the right as well: <Window.Resources> <DataTemplate x:Key="PersonTemplate" DataType="Minimal.Client.Person"> <Border BorderBrush="Purple" BorderThickness="2" CornerRadius="2" Padding="5" Margin="5"> <Grid Margin="10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" MinWidth="200"/> <ColumnDefinition Width="Auto" MaxWidth="200"/> </Grid.ColumnDefinitions> <StackPanel Grid.Column ="0" Orientation="Horizontal" > <TextBlock FontFamily="Verdana" FontSize="16" FontWeight="Bold" Text="{Binding LastName}" /> <TextBlock FontFamily="Verdana" FontSize="16" Text=", " /> <TextBlock FontFamily="Verdana" FontSize="16" Text="{Binding FirstName}" /> </StackPanel> <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Right"> <Border BorderBrush="Black" BorderThickness="1"> <Image Source="{Binding Picture}" Width="180" Height="150" /> </Border> </StackPanel> </Grid> </Border> </DataTemplate> </Window.Resources> Any suggestions?

    Read the article

  • Error in Getting Youtube Video Title, Description and thumbnail

    - by Muhammad Ayyaz Zafar
    I was getting youtube title and youtube description form the same code but now its not working I am getting following error: Warning: DOMDocument::load() [domdocument.load]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/colorsfo/public_html/zaroorat/admin/pages/addSongProcess.php on line 16 Warning: DOMDocument::load(http://gdata.youtube.com/feeds/api/videos/Y7G-tYRzwYY) [domdocument.load]: failed to open stream: no suitable wrapper could be found in /home/colorsfo/public_html/zaroorat/admin/pages/addSongProcess.php on line 16 Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/videos/Y7G-tYRzwYY" in /home/colorsfo/public_html/zaroorat/admin/pages/addSongProcess.php on line 16 .................................... Following Coding is used to get Youtube Video Data: $url = "http://gdata.youtube.com/feeds/api/videos/".$embedCodeParts2[0]; $doc = new DOMDocument; @$doc->load($url); $title = $doc->getElementsByTagName("title")->item(0)->nodeValue; $videoDescription = $doc->getElementsByTagName("description")->item(0)->nodeValue; It was working before (This coding is working fine in Local server but on internet its not working) but now its not working. Please guide me how to fix this error. Thanks for your time.

    Read the article

  • How to get bit rotation function to accept any bit size?

    - by calccrypto
    i have these 2 functions i got from some other code def ROR(x, n): mask = (2L**n) - 1 mask_bits = x & mask return (x >> n) | (mask_bits << (32 - n)) def ROL(x, n): return ROR(x, 32 - n) and i wanted to use them in a program, where 16 bit rotations are required. however, there are also other functions that require 32 bit rotations, so i wanted to leave the 32 in the equation, so i got: def ROR(x, n, bits = 32): mask = (2L**n) - 1 mask_bits = x & mask return (x >> n) | (mask_bits << (bits - n)) def ROL(x, n, bits = 32): return ROR(x, bits - n) however, the answers came out wrong when i tested this set out. yet, the values came out correctly when the code is def ROR(x, n): mask = (2L**n) - 1 mask_bits = x & mask return (x >> n) | (mask_bits << (16 - n)) def ROL(x, n,bits): return ROR(x, 16 - n) what is going on and how do i fix this?

    Read the article

  • Color picker does not give gradient appearance

    - by ykaratoprak
    i added below codes. But it generates to me 16 color. but i need 16 color between "red" and "khaki". i don't need gradient flow. My colors look like gradient flow. My colors must not closer to each other. Because i will use this codes return values in chart columns. they are too near each other. static class Program { [STAThread] static void Main() { Form form = new Form(); Color start = Color.Red, end = Color.Khaki; for (int i = 0; i < 16; i++) { int r = Interpolate(start.R, end.R, 15, i), g = Interpolate(start.G, end.G, 15, i), b = Interpolate(start.B, end.B, 15, i); Button button = new Button(); button.Dock = DockStyle.Top; button.BackColor = Color.FromArgb(r, g, b); form.Controls.Add(button); button.BringToFront(); } Application.Run(form); } static int Interpolate(int start, int end, int steps, int count) { float s = start, e = end, final = s + (((e - s) / steps) * count); return (int)final; } }

    Read the article

  • SEO, ordering and duplication of content

    - by piquadrat
    I run a specialized news site and am trying to apply a little bit of SEO sauce to it. One of the most important things I hear is to avoid duplication of content. I've covered all the basics but I'm stuck with ordering of content. As an example, the archive of the site is orderable by date, views, and rating. Since we don't have that many news items, an archive page for a particular day has usually only a couple of items, so the following URLs all have the same content, albeit in different ordering: /news/archive/2010/05/16/ /news/archive/2010/05/16/?o=views /news/archive/2010/05/16/?o=rating Do search machines penalize this particular kind of duplication of content? And if yes, what's the best way to avoid said penalty? <link rel="canonical" />? Tell Google & Co. to ingore the o parameter? Marking the ordering links with nofollow? Only allow the indexation of the date-ordered archive sites through robots.txt (not sure if this is even possible)?

    Read the article

  • Delphi trace tool

    - by Max
    I was wondering if there's a tool or a component for Delphi that can trace method execution line by line and create a log file. With this kind of tool it is easy to compare how method performs on two sets of input data by comparing two log files. EDIT: Let's say there is a function 10: function MyFunction(aInput: Integer): Integer; 11: begin 12: if aInput 10 then 13: Result := 10 14: else 15: Result := 0; 16: end; I'm looking for a tool that would give the log which whould be similar to the following: When aInput parameter is 1: Line 10: 'function MyFunction(aInput: Integer): Integer;' Line 11: 'begin' Line 12: 'if aInput 10 then' Line 15: 'Result := 0;' Line 16: 'end;' and when aInput parameter is 11: Line 10: 'function MyFunction(aInput: Integer): Integer;' Line 11: 'begin' Line 12: 'if aInput 10 then' Line 13: 'Result := 10;' Line 16: 'end;' The only information that should be required by the tool is the function name. It's like stepping through the method under debugger, but in an automatic manner with logging every line of code.

    Read the article

  • geom_ribbon doesn't work - Error in eval(expr, envir, enclos) : object 'variable' not found

    - by Marciszka
    I try to add a geom_ribbon object to my ggplot2 plot. In my data frame, I have an NA values that (I guess) may cause a problem. This is a reproducible example of data drame I have: base <- c(1:10, rep(NA, 10)) output1 <- c(rep(NA, 9), 10 - 0:10) output2 <- c(rep(NA, 9), 10 + 0:10) xaxis <- 1:20 df <- data.frame(xaxis, base, output1, output2) df xaxis base output1 output2 1 1 1 NA NA 2 2 2 NA NA 3 3 3 NA NA 4 4 4 NA NA 5 5 5 NA NA 6 6 6 NA NA 7 7 7 NA NA 8 8 8 NA NA 9 9 9 NA NA 10 10 10 10 10 11 11 NA 9 11 12 12 NA 8 12 13 13 NA 7 13 14 14 NA 6 14 15 15 NA 5 15 16 16 NA 4 16 17 17 NA 3 17 18 18 NA 2 18 19 19 NA 1 19 20 20 NA 0 20 And my attempt to plot a ggplot2 object with a geom_ribbon: dfm <- melt(df, id=1) ggplot(dfm, aes(x = xaxis, y = value, colour = variable)) + geom_line(aes(group=variable)) + geom_ribbon(data=df, aes(group = 1, ymin=output1, ymax=output2)) And, eventually, I got an error I cannot deal with: Error in eval(expr, envir, enclos) : object 'variable' not found Thank ypu in advance for any suggestions.

    Read the article

  • Mutual class instances in C++

    - by SepiDev
    Hi guys. What is the issue with this code? Here we have two files: classA.h and classB.h classA.h: #ifndef _class_a_h_ #define _class_a_h_ #include "classB.h" class B; //???? class A { public: A() { ptr_b = new B(); //???? } virtual ~A() { if(ptr_b) delete ptr_b; //???? num_a = 0; } int num_a; B* ptr_b; //???? }; #endif //_class_a_h_ classB.h: #ifndef _class_b_h_ #define _class_b_h_ #include "classA.h" class A; //???? class B { public: B() { ptr_a = new A(); //???? num_b = 0; } virtual ~B() { if(ptr_a) delete ptr_a; //???? } int num_b; A* ptr_a; //???? }; #endif //_class_b_h_ when I try to compile it, the compiler (g++) says: classB.h: In constructor ‘B::B()’: classB.h:12: error: invalid use of incomplete type ‘struct A’ classB.h:6: error: forward declaration of ‘struct A’ classB.h: In destructor ‘virtual B::~B()’: classB.h:16: warning: possible problem detected in invocation of delete operator: classB.h:16: warning: invalid use of incomplete type ‘struct A’ classB.h:6: warning: forward declaration of ‘struct A’ classB.h:16: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined.

    Read the article

  • Wildcards vs. generic methods

    - by FredOverflow
    Is there any practical difference between the following approaches to print all elements in a range? public static void printA(Iterable<?> range) { for (Object o : range) { System.out.println(o); } } public static <T> void printB(Iterable<T> range) { for (T x : range) { System.out.println(x); } } Apparently, printB involves an additional checked cast to Object (see line 16), which seems rather stupid to me -- isn't everything an Object anyway? public static void printA(java.lang.Iterable); Code: 0: aload_0 1: invokeinterface #18, 1; //InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator; 6: astore_2 7: goto 24 10: aload_2 11: invokeinterface #24, 1; //InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object; 16: astore_1 17: getstatic #30; //Field java/lang/System.out:Ljava/io/PrintStream; 20: aload_1 21: invokevirtual #36; //Method java/io/PrintStream.println:(Ljava/lang/Object;)V 24: aload_2 25: invokeinterface #42, 1; //InterfaceMethod java/util/Iterator.hasNext:()Z 30: ifne 10 33: return public static void printB(java.lang.Iterable); Code: 0: aload_0 1: invokeinterface #18, 1; //InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator; 6: astore_2 7: goto 27 10: aload_2 11: invokeinterface #24, 1; //InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object; 16: checkcast #3; //class java/lang/Object 19: astore_1 20: getstatic #30; //Field java/lang/System.out:Ljava/io/PrintStream; 23: aload_1 24: invokevirtual #36; //Method java/io/PrintStream.println:(Ljava/lang/Object;)V 27: aload_2 28: invokeinterface #42, 1; //InterfaceMethod java/util/Iterator.hasNext:()Z 33: ifne 10 36: return

    Read the article

  • [AS3] Calling Php Script with UTF-8 POST variables

    - by kornelijepetak
    AS3 documentation says that Strings in AS3 are in UTF-16 format. There is a textbox on a Flash Clip where user can type some data. When a button is clicked, I want this data to be sent to a php script. I have everything set up, but it seems that the PHP script gets the data in UTF-16 format. The data in the database (which is utf-8) shows some unrecognizable characters (where special characters are used), meaning that the data has not been sent in a correct encoding. var variables:URLVariables=new URLVariables; var varSend:URLRequest=new URLRequest("http://website.com/systematic/accept.php"); varSend.method=URLRequestMethod.POST; varSend.data=variables; var varLoader:URLLoader=new URLLoader; varLoader.dataFormat=URLLoaderDataFormat.VARIABLES; varLoader.addEventListener(Event.COMPLETE, completeHandler); When submit button is clicked, the following handler gets executed. function sendData(event:MouseEvent) : void { // i guess here is the problem (tbName.text is UTF-16) variables.name = tbName.text; varLoader.load(varSend); } Is there any way to send the data so that PHP script gets the data in UTF-8 format? (PHP script is retrieving the value using the $_POST['name']).

    Read the article

  • Issue with creating index organized table

    - by mtim
    I'm having a weird problem with index organized table. I'm running Oracle 11g standard. i have a table src_table SQL> desc src_table; Name Null? Type --------------- -------- ---------------------------- ID NOT NULL NUMBER(16) HASH NOT NULL NUMBER(3) ........ SQL> select count(*) from src_table; COUNT(*) ---------- 21108244 now let's create another table and copy 2 columns from src_table set timing on SQL> create table dest_table(id number(16), hash number(20), type number(1)); Table created. Elapsed: 00:00:00.01 SQL> insert /*+ APPEND */ into dest_table (id,hash,type) select id, hash, 1 from src_table; 21108244 rows created. Elapsed: 00:00:15.25 SQL> ALTER TABLE dest_table ADD ( CONSTRAINT dest_table_pk PRIMARY KEY (HASH, id, TYPE)); Table altered. Elapsed: 00:01:17.35 It took Oracle < 2 min. now same exercise but with IOT table SQL> CREATE TABLE dest_table_iot ( id NUMBER(16) NOT NULL, hash NUMBER(20) NOT NULL, type NUMBER(1) NOT NULL, CONSTRAINT dest_table_iot_PK PRIMARY KEY (HASH, id, TYPE) ) ORGANIZATION INDEX; Table created. Elapsed: 00:00:00.03 SQL> INSERT /*+ APPEND */ INTO dest_table_iot (HASH,id,TYPE) SELECT HASH, id, 1 FROM src_table; "insert" into IOT takes 18 hours !!! I have tried it on 2 different instances of Oracle running on win and linux and got same results. What is going on here ? Why is it taking so long ?

    Read the article

  • slowAES encryption and java descryption

    - by amnon
    Hi , I've tried to implement the same steps as discussed in AES .NET but with no success , i can't seem to get java and slowAes to play toghter ... attached is my code i'm sorry i can't add more this is my first time trying to deal with encryption would appreciate any help private static final String ALGORITHM = "AES"; private static final byte[] keyValue = getKeyBytes("12345678901234567890123456789012"); private static final byte[] INIT_VECTOR = new byte[16]; private static IvParameterSpec ivSpec = new IvParameterSpec(INIT_VECTOR); public static void main(String[] args) throws Exception { String encoded = encrypt("watson?"); System.out.println(encoded); } private static Key generateKey() throws Exception { Key key = new SecretKeySpec(keyValue, ALGORITHM); // SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM); // key = keyFactory.generateSecret(new DESKeySpec(keyValue)); return key; } private static byte[] getKeyBytes(String key) { byte[] hash = DigestUtils.sha(key); byte[] saltedHash = new byte[16]; System.arraycopy(hash, 0, saltedHash, 0, 16); return saltedHash; } public static String encrypt(String valueToEnc) throws Exception { Key key = generateKey(); Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); c.init(Cipher.ENCRYPT_MODE, key,ivSpec); byte[] encValue = c.doFinal(valueToEnc.getBytes()); String encryptedValue = new BASE64Encoder().encode(encValue); return encryptedValue; } public static String decrypt(String encryptedValue) throws Exception { Key key = generateKey(); Cipher c = Cipher.getInstance(ALGORITHM); c.init(Cipher.DECRYPT_MODE, key); byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedValue); byte[] decValue = c.doFinal(decordedValue); String decryptedValue = new String(decValue); return decryptedValue; } the bytes returned are different thanks in advance .

    Read the article

  • convert variable with mixed date formats to one format in r

    - by jalapic
    A sample of my dataframe: date 1 25 February 1987 2 20 August 1974 3 9 October 1984 4 18 August 1992 5 19 September 1995 6 16-Oct-63 7 30-Sep-65 8 22 Jan 2008 9 13-11-1961 10 18 August 1987 11 15-Sep-70 12 5 October 1994 13 5 December 1984 14 03/23/87 15 30 August 1988 16 26-10-1993 17 22 August 1989 18 13-Sep-97 I have a large dataframe with a date variable that has multiple formats for dates. Most of the formats in the variable are shown above- there are a couple of very rare others too. The reason why there are multiple formats is that the data were pulled together from various websites that each used different formats. I have tried using straightforward conversions e.g. strftime(mydf$date,"%d/%m/%Y") but these sorts of conversion will not work if there are multiple formats. I don't want to resort to multiple gsub type editing. I was wondering if I am missing a more simple solution? Code for example: structure(list(date = structure(c(12L, 8L, 18L, 6L, 7L, 4L, 14L, 10L, 1L, 5L, 3L, 17L, 16L, 11L, 15L, 13L, 9L, 2L), .Label = c("13-11-1961", "13-Sep-97", "15-Sep-70", "16-Oct-63", "18 August 1987", "18 August 1992", "19 September 1995", "20 August 1974", "22 August 1989", "22 Jan 2008", "03/23/87", "25 February 1987", "26-10-1993", "30-Sep-65", "30 August 1988", "5 December 1984", "5 October 1994", "9 October 1984"), class = "factor")), .Names = "date", row.names = c(NA, -18L), class = "data.frame")

    Read the article

  • How to convert Big Endian and how to flip the highest bit?

    - by Robert Frank
    I am using a TStream to read binary data (thanks to this post: http://stackoverflow.com/questions/2878180/how-to-use-a-tfilestream-to-read-2d-matrices-into-dynamic-array). My next problem is that the data is Big Endian. From my reading, the Swap() method is seemingly deprecated. How would I swap the types below? 16-bit two's complement binary integer 32-bit two's complement binary integer 64-bit two's complement binary integer IEEE single precision floating-point - Are IEEE affected by Big Endian? And, finally, since the data is unsigned, the creators of this dataset have stored the unsigned values as signed integers (excluding the IEEE). They instruct that one need only add an offset (2^15, 2^31, and 2^63) to recover the unsigned data. But, they note that flipping the most significant bit is the fastest way to do that. How does one efficiently flip the most significant bit of a 16, 32, or 64-bit integer? So, if the data on disk (16-bit) is "85 FB" - the desired result after reading the data and swapping and bit flipping would be 1531. Is there a way to accomplish the swapping and bit flipping with generics so it fits into the generic answer at the link above? Yes, kids, THIS is how scientific astronomical data is stored by NASA, ESO, and all professional astronomers. This FITS standard is considered by some to be one of the most successful standards ever created in its proliferation and flexibility!

    Read the article

  • C to Assembly code - what does it mean

    - by Smith
    I'm trying to figure out exactly what is going on with the following assembly code. Can someone go down line by line and explain what is happening? I input what I think is happening (see comments) but need clarification. .file "testcalc.c" .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "x=%d, y=%d, z=%d, result=%d\n" .text .globl main .type main, @function main: leal 4(%esp), %ecx // establish stack frame andl $-16, %esp // decrement %esp by 16, align stack pushl -4(%ecx) // push original stack pointer pushl %ebp // save base pointer movl %esp, %ebp // establish stack frame pushl %ecx // save to ecx subl $36, %esp // alloc 36 bytes for local vars movl $11, 8(%esp) // store 11 in z movl $6, 4(%esp) // store 6 in y movl $2, (%esp) // store 2 in x call calc // function call to calc movl %eax, 20(%esp) // %esp + 20 into %eax movl $11, 16(%esp) // WHAT movl $6, 12(%esp) // WHAT movl $2, 8(%esp) // WHAT movl $.LC0, 4(%esp) // WHAT?!?! movl $1, (%esp) // move result into address of %esp call __printf_chk // call printf function addl $36, %esp // WHAT? popl %ecx popl %ebp leal -4(%ecx), %esp ret .size main, .-main .ident "GCC: (Ubuntu 4.3.3-5ubuntu4) 4.3.3" .section .note.GNU-stack,"",@progbits Original code: #include <stdio.h> int calc(int x, int y, int z); int main() { int x = 2; int y = 6; int z = 11; int result; result = calc(x,y,z); printf("x=%d, y=%d, z=%d, result=%d\n",x,y,z,result); }

    Read the article

  • C++ arrays as parameters, subscript vs. pointer

    - by awshepard
    Alright, I'm guessing this is an easy question, so I'll take the knocks, but I'm not finding what I need on google or SO. I'd like to create an array in one place, and populate it inside a different function. I define a function: void someFunction(double results[]) { for (int i = 0; i<100; ++i) { for (int n = 0; n<16; ++n) //note this iteration limit { results[n] += i * n; } } } That's an approximation to what my code is doing, but regardless, shouldn't be running into any overflow or out of bounds issues or anything. I generate an array: double result[16]; for(int i = 0; i<16; i++) { result[i] = -1; } then I want to pass it to someFunction someFunction(result); When I set breakpoints and step through the code, upon entering someFunction, results is set to the same address as result, and the value there is -1.000000 as expected. However, when I start iterating through the loop, results[n] doesn't seem to resolve to *(results+n) or *(results+n*sizeof(double)), it just seems to resolve to *(results). What I end up with is that instead of populating my result array, I just get one value. What am I doing wrong?

    Read the article

  • UIDocumentInteractionController & ARC: [UIPopoverController dealloc] reached while popover is still visible

    - by muffel
    This issue or similar issues have been discussed here before, but I didn't find any working solution for me. I am using the following code to display a UIDocumentInteractionController on an ARC-enabled iOS 7 project: - (void) exportDoc{ // [...] docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]]; docController.delegate = self; [docController presentOpenInMenuFromBarButtonItem:mainMenuButton animated:YES]; } First I didn't want to create a property that holds the controller reference, but as many people said that there are not alternatives to it. It is defined as @property (strong) UIDocumentInteractionController* docController; exportDoc is run in the main thread using NSOperationQueue. Whenever it is executed, I get the following error message: Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.' This is what the backtrace says: (lldb) bt * thread #1: tid = 0x1c97d9, 0x000000019a23c1c0 libobjc.A.dylibobjc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1 frame #0: 0x000000019a23c1c0 libobjc.A.dylibobjc_exception_throw frame #1: 0x000000018d982e90 CoreFoundation+[NSException raise:format:] + 128 frame #2: 0x0000000190bc348c UIKit-[UIPopoverController dealloc] + 96 frame #3: 0x0000000190e18fc8 UIKit-[UIDocumentInteractionController dealloc] + 168 frame #4: 0x000000019a255474 libobjc.A.dylib(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 524 frame #5: 0x000000018d881988 CoreFoundation_CFAutoreleasePoolPop + 28 frame #6: 0x000000018e42cb18 Foundation-[NSOperationInternal _start:] + 892 frame #7: 0x000000018e4eea38 Foundation__NSOQSchedule_f + 76 frame #8: 0x000000019a813fd4 libdispatch.dylib_dispatch_client_callout + 16 frame #9: 0x000000019a8171dc libdispatch.dylib_dispatch_main_queue_callback_4CF + 336 frame #10: 0x000000018d942c2c CoreFoundation__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 frame #11: 0x000000018d940f6c CoreFoundation__CFRunLoopRun + 1452 frame #12: 0x000000018d881c20 CoreFoundationCFRunLoopRunSpecific + 452 frame #13: 0x0000000193511c0c GraphicsServicesGSEventRunModal + 168 frame #14: 0x00000001909b2fdc UIKitUIApplicationMain + 1156 * frame #15: 0x000000010000947c MyApplicationmain(argc=1, argv=0x000000016fdfbc80) + 108 at main.m:16 frame #16: 0x000000019a82faa0 libdyld.dylibstart + 4 As far as I understand the autoreleasepool just releases the controller. Shouldn't this be prevented by using a strong property just as I did? Do you have any idea what the problem can be and how I can solve it?

    Read the article

  • Problem inserting Pygames on a wxPython panel using Boa Constructor

    - by Kohwalter
    Hello, im new in Python so im hoping to to get some help to figure out what is going wrong. Im trying to run a Pygames from within wxPython panel (made on Boa Constructor). To do that i followed the instructions on the http://wiki.wxpython.org/IntegratingPyGame but still it isn't working. Here is the Panel code that was used to make the integration: class PG_panel(wx.Panel): def __init__(self, ID, name, parent, mypos, mysize): # pygame is imported in this class # make it globally available global pygame #self.Fit() wx.Panel.__init__(self, id=wxID_FRMMAINPANELTABULEIRO, name='panelTabuleiro', parent=self, pos=(16, 96), size=mysize) # pygame uses SDL, set the environment variables os.environ['SDL_WINDOWID'] = str(self.GetHandle()) os.environ['SDL_VIDEODRIVER'] = 'windib' # do the pygame stuff after setting the environment variables import pygame pygame.display.init() # create the pygame window/screen screen = pygame.display.set_mode(464, 464) #(424,450) # start the thread instance self.thread = PG_thread(screen) self.thread.start() def __del__(self): self.thread.stop() And im trying to use that panel on an interface from Boa Constructor, here is the code: class frmMain(wx.Frame): def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRMMAIN, name='frmMain', parent=prnt, pos=wx.Point(660, 239), size=wx.Size(815, 661), style=wx.DEFAULT_FRAME_STYLE, title='Grupo 1 - Jogo de Damas') self._init_utils() self.SetClientSize(wx.Size(799, 623)) self.SetBackgroundColour(wx.Colour(225, 225, 225)) self.SetMinSize(wx.Size(784, 650)) self.Center(wx.BOTH) self.SetMenuBar(self.menuBar1) #here begins my code mysize = (464, 464) mypos = (16, 96) self.panelTabuleiro = PG_panel(wxID_FRMMAINPANELTABULEIRO, 'panelTabuleiro', self, mypos, mysize) The original that was auto-made by the Boa Constructor is the following: self.panelTabuleiro = wx.Panel(id=wxID_FRMMAINPANELTABULEIRO, name='panelTabuleiro', parent=self, pos=wx.Point(16, 96), size=wx.Size(464, 464), style=wx.TAB_TRAVERSAL) self.panelTabuleiro.SetBackgroundColour(wx.Colour(232, 249, 240)) self.panelTabuleiro.SetThemeEnabled(True) self.panelTabuleiro.SetHelpText('Tabuleiro') The error that it gives is: Type error: in method 'new_Panel', expected argument 1 of type 'wxWindow*1 Exception AttributeError: "'PG_panel' object has no attribute 'thread' in ignored Any thoughts ? I appreciate any help. Thank you.

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >