Daily Archives

Articles indexed Monday October 15 2012

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

  • How can I prevent spam on sites which I control?

    - by danlefree
    This is a general, community wiki question to address all non-specific spam prevention questions. If your question was closed as a duplicate of this question and you feel that the information provided here does not provide a sufficient answer, please open a discussion on Pro Webmasters Meta. For purposes of this question, spam will include: Any automated post Manually-posted content which includes links to spammers' sites Manually-posted content which includes instructions to visit a spammer's site

    Read the article

  • Embedding Pygame to C++ [closed]

    - by Pendertuga
    If embedding Pygame to C++ to have a game be an executable, is there any extra process I would have to use in order to use Pygame functions when embedding into C++? As opposed to just writing embedding code in C++ for normal Python code? To clear cut the question I want to know if it's the same process without having to call different functions. EDIT: My question is if I have to call different functions in C++ when embedding Python code that uses Pygame modules. I am NOT using pygame2exe nor py2exe. I never even mentioned those. My question is solely about code embedding.

    Read the article

  • ExtJS Output JSON

    - by venkatesh a
    This is my Json structure. Got load into the form perfectly. Once i alter this form and click submit button. Output have to save with same structure like existing. Can anyone please help me to solve this ASAP?? { "comment": null, "clientinfo": { "clientName": "Timex", "clientCode": "143", "startDate": "04-Oct-2012", "clientType": "CR", "clientID": "TimexGroup", "hasGAMLeft": null, "gamLocation": "GB", "clientName": "xxx", "groupSegment": "FI", "groupSubSegment": "SUB-FI-SUB", "groupDomicileCounrty": "IN", "groupIsicCode": "2403-Copper & zinc" }, "CompanyClients": [ { "CName": "Timex", "ID": "1424317", "cType": "CR", "gType": "SD" }, { "CName": "Casio", "ID": "1416529", "cType": "AR", "gType": "RD" } ], "Country": [ { "CountryID": "Singapore", "CountryText": "SG" }, { "CountryID": "India", "CountryText": "IN" } ] } I used below code to POST. saves fine as its handcoded. i need to save this dynamically.

    Read the article

  • Spinner setonitemselectedlistener is not called

    - by Gabrielle
    I have a strange problem. I need to do something when an item from spinner is selected. Here is my code : language = (Spinner) findViewById(R.id.current_language_text); ArrayAdapter adapter = new ArrayAdapter(this, com.Orange.R.layout.my_spinner_textview, languages); adapter.setDropDownViewResource(com.Orange.R.layout.multiline_spinner_dropdown_item); language.setAdapter(adapter); language.setSelection(Integer.valueOf(language_id) - 1); language.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { System.out.println("position "+position); Toast.makeText(Settings.this, "Hello Toast",Toast.LENGTH_SHORT).show(); } @Override public void onNothingSelected(AdapterView<?> parentView) { // your code here } }); The problem is that onItemSelectedListener is not called. I put System.out.println in onItemSelected() but I don't get it in LogCat. I tried with Toast, and I get the same, it doesn't appear. Every time I select an item from spinner, in LogCat I get this warning : Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@2b1dabd0 Any idea why onItemSelectedListener is not called ?

    Read the article

  • TCP client in C and server in Java

    - by faldren
    I would like to communicate with 2 applications : a client in C which send a message to the server in TCP and the server in Java which receive it and send an acknowledgement. Here is the client (the code is a thread) : static void *tcp_client(void *p_data) { if (p_data != NULL) { char const *message = p_data; int sockfd, n; struct sockaddr_in serv_addr; struct hostent *server; char buffer[256]; sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { error("ERROR opening socket"); } server = gethostbyname(ALARM_PC_IP); if (server == NULL) { fprintf(stderr,"ERROR, no such host\n"); exit(0); } bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length); serv_addr.sin_port = htons(TCP_PORT); if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) { error("ERROR connecting"); } n = write(sockfd,message,strlen(message)); if (n < 0) { error("ERROR writing to socket"); } bzero(buffer,256); n = read(sockfd,buffer,255); if (n < 0) { error("ERROR reading from socket"); } printf("Message from the server : %s\n",buffer); close(sockfd); } return 0; } And the java server : try { int port = 9015; ServerSocket server=new ServerSocket(port); System.out.println("Server binded at "+((server.getInetAddress()).getLocalHost()).getHostAddress()+":"+port); System.out.println("Run the Client"); while (true) { Socket socket=server.accept(); BufferedReader in= new BufferedReader(new InputStreamReader(socket.getInputStream())); System.out.println(in.readLine()); PrintStream out=new PrintStream(socket.getOutputStream()); out.print("Welcome by server\n"); out.flush(); out.close(); in.close(); System.out.println("finished"); } } catch(Exception err) { System.err.println("* err"+err); } With n = read(sockfd,buffer,255); the client is waiting a response and for the server, the message is never ended so it doesn't send a response with PrintStream. If I remove these lines : bzero(buffer,256); n = read(sockfd,buffer,255); if (n < 0) { error("ERROR reading from socket"); } printf("Message from the server : %s\n",buffer); The server knows that the message is finished but the client can't receive the response. How solve that ? Thank you

    Read the article

  • Sha256 is giving junk output

    - by user1746617
    hey can u be more specific on how to convert to bin to hex. bool HashStatus::calculate_digest_value(char * path,unsigned char * output) { FILE* file = fopen(path, "rb"); if(!file) { g_message("SignatureValidator::VerifyReferences,file not opened"); return -1; } unsigned char hash[SHA256_DIGEST_LENGTH]; SHA256_CTX sha256; SHA256_Init(&sha256); const int bufSize = 32768; unsigned char* buffer = malloc(bufSize); int bytesRead = 0; if(!buffer) return NULL; while((bytesRead = fread(buffer, 1, bufSize, file))) { g_message("calculate digest value,verify.cpp::%s",buffer); SHA256_Update(&sha256, buffer, bytesRead); } SHA256_Final(hash, &sha256); g_message("verify.cpp,after final"); sha256_hash_string(hash, output); g_message("verify.cpp,after sha256_hash_string %s",hash); fclose(file); free(buffer); return true; } this is my code to convert file data into hash using sha256 openssl function o/p is :1d54e12333988471354907a760b9cde861423615bb5255ee837e3b27b32366 but actual o/p is:HVThAjM5iEcTVJB6dgC5zehhQjYVu1JV7oN+OyezI2Y= can you guys please help me with whatz wrong with this code,ASAP and i'm new to this please guide me step by step and in detail..

    Read the article

  • Database Logon Error in crystal report

    - by yasar arafat
    am really very dumb as this problem is being answered so many times but eally its above my head. i dont have any idea about working with crystal reports or asp.net but due to some reason i have to work on it. after trying very hard i m able to design on crystal report connecting it with mysql database. now when i see in the crystalreport preview i am able to see the report and the data ![enter image description here][1] but when i try to run it on server it says database logon failed![enter image description here][2] now i really dont know what to do i am pasting my aspx and aspx.vb code here and please repley in english not computer language believe me i m super dumb enter code here aspx codes <%@ Page Title="" Language="VB" MasterPageFile="~/Master/Site.master"AutoEventWireup="false" CodeFile="ManHourCostExpenditure.aspx.vb" Inherits="ManHourCostExpenditure" %> <%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" GroupTreeImagesFolderUrl="" Height="1202px" ReportSourceID="CrystalReportSource1" ToolbarImagesFolderUrl="" ToolPanelView="None" ToolPanelWidth="200px" Width="903px" BorderColor="#660033" BorderStyle="Solid" BorderWidth="1px" HasCrystalLogo="False" /> <CR:CrystalReportSource ID="CrystalReportSource1" runat="server"> <Report FileName="CrDiscProjManHoursActVsEst.rpt"> </Report> </CR:CrystalReportSource> </asp:Content> aspxdotvb codes Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports CrystalDecisions.Enterprise Imports CrystalDecisions.ReportSource Imports CrystalDecisions.Web Imports CrystalDecisions.Windows.Forms Imports MySql Imports MySql.Data Imports MySql.Data.MySqlClient Imports System.Collections Imports System.Collections.Generic Imports System.Text Imports CrystalDecisions Imports CrystalDecisions.CrystalReports Imports CrystalReportsReportDefModelLib Partial Class ManHourCostExpenditure Inherits System.Web.UI.Page Dim CrRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim StrConn As String = "SERVER=localhost;DATABASE=fluor;UID=root; PWD=root;" Dim Conn As New MySqlConnection(StrConn) Conn.Open() Dim CrRpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument 'Session.Add("REPORT_KEY", CrRpt) CrRpt.Load(Server.MapPath("CrManHourCostExpenditure.rpt")) CrRpt.PrintOptions.PaperOrientation = PaperOrientation.Landscape 'If IsPostBack Then ' CrRpt = CType(Session.Item("REPORT_KEY"), Group) ' CrystalReportViewer1.ReportSource = CrRpt 'End If CrystalReportViewer1.ReportSource = CrRpt 'CrystalReportViewer1.DataBind() CrystalReportViewer1.RefreshReport() Conn.Close() 'CrRpt.Close() 'CrRpt.Dispose() End Sub Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload 'CrystalReportViewer1.ReportSource.Close() CrRpt.Close() CrRpt.Dispose() End Sub 'Protected Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload ' CrRpt.Close() ' CrRpt.Dispose() 'End Sub End Class please help me. thanks in advance.... yasir

    Read the article

  • Error while installing joomla on iss

    - by Anand
    Hello Guys i have a server on that server iis 7 ,php(5.3.13),.net and mysql is installed and i can easily connect with the mysql but when i am installing joomla and enter DB configuration then hit enter or press Next button then nothing happend and url changes from http://localhost/joomlatest3/installation/index.php to http://localhost/joomlatest3/installation/index.php# i have install fresh stable package 2.5.7 And i have tried joomla 1.5 and 3.0 but the same problem persist any idea why this error is coming Thanks in advance Anand Neema

    Read the article

  • cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number

    - by Joao Figueiredo
    I've a cron scheduled query which is failing with, File "./run_ora_query.py", line 69, in db_lookup cursor.execute(query, dict(time_key=time_key) ) cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number where >>> dict(time_key=time_key) {'time_key': '12/10/2012 19:12:00'} I'm using a .yaml file to update the last time_key after each query runs, where the relevant parameters are, {query: 'select session_mode, inst_id, user_name, schema_name, os_user, process_id, process_mb_use, process_name, to_char(datet,''dd-mm-yyyy hh24:mi'') as DATETIME from os_admin.mem_usage where data > TO_DATE(:time_key,''dd-mm-yyyy hh24:mi:ss'') order by datet, inst_id, os_user', time_key: '12/10/2012 19:12:00'} Where is the culprit for this error?

    Read the article

  • Converting time/date from XML file into MYSQL format

    - by IconicDigital
    One of the affiliate networks provides a feed with the following time/date format. <startDate>1349992800000</startDate> <endDate>1355266799999</endDate> My problem is I am trying to convert this to a MYSQL format, I have tried mktime and strtotime with no luck the date seems to come out wrong. I know this is the time since the Equinox, I am just not sure how to convert this to a MYSQL format.

    Read the article

  • Passing variables from PHP to Javascript back to PHP using Ajax.

    - by ObjectiveJ
    I hope this makes sesne, please bare with me. So I have a PHP page that contains variables, I have some radial boxes, and on click of them, it calculates a price for the item you have clicked on. I do this by activating a js function that I have passed some variables to. Like so. PHP: <?php $result = mssql_query("SELECT * FROM Segments ORDER BY 'Squares'"); if (!$result) { echo 'query failed'; exit; } while ($row = mssql_fetch_array($result)) { ?> <span><?php echo $row["Squares"]; ?></span><input name="squares" type="radio" onclick="ajaxCases('<?php echo $row["Squares"]; ?>', '<?php echo $row["StartCaseID"]; ?>', '<?php echo $row["StartMatrixPrice"]; ?>')" value="<?php echo $row["Squares"]; ?>"<?php if ($row["Squares"] == "1") { ?> checked="checked" <?php }else{ ?> checked="" <?php } ?>/> <?php } ?> As you can see onclick it goes to a function called ajaxcases, this function looks like this. function ajaxCases(squares,start,price){ $('#step1').html('<p style="margin:100px 0px 0px 100px"><img src="images/ajax-loader-bigindic.gif" width="32" height="32" alt="" /></p>'); $('#step1').load("ajax-styles.php?squares="+squares); prevId1 = ""; document.varsForm.caseid.value=start; $('#step1price').html('<span style="margin:0px 0px 0px 30px"><img src="images/ajax-loader-price.gif" width="24" height="24" alt="" /></span>'); $('#step1price').load("ajax-step1-price.php?Squares="+Squares); return true; } This then goes to a php page called ajax-step1-price.php and I try to recall the variable Squares. However it doesn't work, I thought it was a GET however that returns undefined. In Summary: I would like to know how to pass a variable from PHP to JS then back to PHP, or if someone could just tell me where I am going wrong that would be greatly appreciated.

    Read the article

  • Keep getting error class, interface, or enum expected

    - by user1746605
    I can't see the problem with this short class. I get 8 class, interface, or enum expected errors. Thanks public class BankAccount { public BankAccount { private double balance = 0; } public BankAccount(double balanceIn) { private double balance = balanceIn; } public double checkBalance { return balance; } public void deposit(double amount) { if(amount > 0) balance += amount; } public void withdraw(double amount) { if(amount <= balance) balance -= amount; } }

    Read the article

  • Abort early in a fold

    - by Heptic
    What's the best way to terminate a fold early? As a simplified example, imagine I want to sum up the numbers in an Iterable, but if I encounter something I'm not expecting (say an odd number) I might want to terminate. This is a first approximation def sumEvenNumbers(nums: Iterable[Int]): Option[Int] = { nums.foldLeft (Some(0): Option[Int]) { case (None, _) => None case (Some(s), n) if n % 2 == 0 => Some(s + n) case (Some(_), _) => None } } However, this solution is pretty ugly (as in, if I did a .foreach and a return -- it'd be much cleaner and clearer) and worst of all, it traverses the entire iterable even if it encounters a non-even number. So what would be the best way to write a fold like this, that terminates early? Should I just go and write this recursively, or is there a more accepted way?

    Read the article

  • cannot access sql server after publishing site in iis7

    - by vinu
    I am created a website using visual studio 2010. On the time of the development of website I am able to access the database.. but after publishing the site using IIS7..i was unable to access the database..the exception occured during that time was "the connection is in the closed state".in IIS7 When I changed the application pool identity to localsystem, it worked. Data base is installed in the same machine. and server is SQL SERVER 2008 R2

    Read the article

  • Method invoked but not returning anything

    - by or azran
    i am calling this method from a touch in UITableViewCell , -(void)PassTitleandiMageByindex:(NSString *)number{ NSLog(@"index : %d",number.intValue); NSArray *objectsinDictionary = [[[NSArray alloc]init]autorelease]; objectsinDictionary = [[DataManeger sharedInstance].sortedArray objectAtIndex:number.intValue]; if ([objectsinDictionary count] > 3) { ProductLabel = [objectsinDictionary objectAtIndex:3]; globaliMageRef = [objectsinDictionary objectAtIndex:2]; [self performSegueWithIdentifier:@"infoseg" sender:self]; }else{ mQid = [objectsinDictionary objectAtIndex:1]; globaliMageRef = [objectsinDictionary objectAtIndex:2]; [mIQEngines Result:mQid]; NSLog(@"mQid : %@ Global : %@",mQid,globaliMageRef); }} Problem:- i am trying to get the same functionality programmatically by calling [self PassTitleandiMageByindex:stringNumber]; when i am calling this programmatically i can see the debug log getting in the place it should be, but nothing happens (by pressing the UITableViewCellon the screen) here is how it turns on by touch, - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSString *st = [NSString stringWithFormat:@"%d",[indexPath row]]; [self PassTitleandiMageByindex:st];} I have also tried to call the table-view delegate by :[[Tview delegate] tableView:Tview didSelectRowAtIndexPath:selectedCellIndexPath]; but, nothing happened.

    Read the article

  • WPF XAML references not resolved via myAssembly.GetReferencedAssemblies()

    - by WPF-it
    I have a WPF container application (with ContentControl host) and a containee application (UserControl). Both are oblivious of each other. Only one XML config file holds the string dllpath of the containee's DLL and full namespace name of the ViewModelClass inside the containee. A generic code in container resolves containee's assembly (Assembly.LoadFrom(dllpath)) and creates the viewmodel's instance using Activator.CreateInstance(vmType). when this viewmodel is hosted inside the ContentControl of the container, and relevant vierwmodel specific ResourceDictionary is added to ContentControl.Resources.MergedDictionaries of the content control of container, so the view loads fine. Now my containee has to host the WPF DataGrid using assembly reference of WPFToolkit.dll from my local C:\Lib folder. The Copy Local reference to the WPFToolkit.dll is added to the .csproj file of the containee's project and its only referred in the UserControl.XAML using its XAML namepsace. This way my bin\debug folder in my containee application, gets the WPFToolkit.dll copied. XAML: xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" <Controls:DataGrid ItemsSource="{Binding AssetList}" ... /> Issue: The moment the ViewModel (i.e. the containee's usercontrol) tries to load itself I get this error. "Cannot find type 'Microsoft.Windows.Controls.DataGrid'. The assembly used when compiling might be different than that used when loading and the type is missing." Hence I tried to load the referenced assemblies of the containee's assembly (myAssembly.GetReferencedAssemblies()) before the viewmodel is hosted. But WPFToolkit isnt there in that list of assemblies! Strange thing is I have another dll referred called Logger.dll in the containee codebase but this one is implemented using C# code behind. So I get its reference correctly resolved in myAssembly.GetReferencedAssemblies(). So does that mean BAML references of assemblies are never resolvable by GetReferencedAssemblies?

    Read the article

  • What is GC holes?

    - by tianyi
    I wrote a long TCP connection socket server in C#. Spike in memory in my server happens. I used dotNet Memory Profiler(a tool) to detect where the memory leaks. Memory Profiler indicates the private heap is huge, and the memory is something like below(the number is not real,what I want to show is the GC0 and GC2's Holes are very very huge, the data size is normal): Managed heaps - 1,500,000KB Normal heap - 1400,000KB Generation #0 - 600,000KB Data - 100,000KB "Holes" - 500,000KB Generation #1 - xxKB Data - 0KB "Holes" - xKB Generation #2 - xxxxxxxxxxxxxKB Data - 100,000KB "Holes" - 700,000KB Large heap - 131072KB Large heap - 83KB Overhead/unused - 130989KB Overhead - 0KB Howerver, what is GC hole? I read an article about the hole: http://kaushalp.blogspot.com/2007/04/what-is-gc-hole-and-how-to-create-gc.html The author said : The code snippet below is the simplest way to introduce a GC hole into the system. //OBJECTREF is a typedef for Object*. { PointerTable *pTBL = o_pObjectClass->GetPointerTable(); OBJECTREF aObj = AllocateObjectMemory(pTBL); OBJECTREF bObj = AllocateObjectMemory(pTBL); //WRONG!!! “aObj” may point to garbage if the second //“AllocateObjectMemory” triggered a GC. DoSomething (aOb, bObj); } All it does is allocate two managed objects, and then does something with them both. This code compiles fine, and if you run simple pre-checkin tests, it will probably “work.” But this code will crash eventually. Why? If the second call to “AllocateObjectMemory” triggers a GC, that GC discards the object instance you just assigned to “aObj”. This code, like all C++ code inside the CLR, is compiled by a non-managed compiler and the GC cannot know that “aObj” holds a root reference to an object you want kept live. ======================================================================== I can't understand what he explained. Does the sample mean aObj becomes a wild pointer after GC? Is it mean { aObj = (*aObj)malloc(sizeof(object)); free(aObj); function(aObj);? } ? I hope somebody can explain it.

    Read the article

  • Display values and how many times they occured using a Dictionary

    - by user1730056
    I've been told to By using a dictionary (or your solution to Part 4), write a method at_least(a, n) that takes a list, a, and an integer, n, as arguments and returns a list containing only the elements of a that occur at least n times. For complete marks, the list should contain the elements in order of their first occurrence in a. I was able to figure this without using a dictionary, with def at_least2(a, n): return [x for x in a if a.count(x) is n] I was wondering how I can write this using a dictionary? The input is: a = [-6, 8, 7, 3, 2, -9, 1, -3, 2, -4, 4, -8, 7, 8, 2, -2, -7, 0, 1, -9, -3, -7, -3, -5, 6, -3, 6, -3, -10, -8] def at_least(a, 2): and the output: [8, 7, 2, -9, 1, -3, 2, -8, 7, 8, 2, -7, 1, -9, -3, -7, -3, 6, -3, 6, -3, -8] Edit: I don't understand how a dictionary is being used, yet the output isn't in dictionary form? My understanding is that dictionaries have values for each object. I'm not sure if I'm using the right terms.

    Read the article

  • AppFabric Cache errors

    - by Joseph
    The AppFabric Cache in our production crashes almost every day, and is highly unstable. The below errors are logged: Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (Sufficient secondaries not present or they are in throttled state.) Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (The request did not find the primary.) AppFabric Caching service crashed.{Lease with external store expired: Microsoft.Fabric.Federation.ExternalRingStateStoreException: Lease already expired at Microsoft.Fabric.Data.ExternalStoreAuthority.UpdateNode(NodeInfo nodeInfo, TimeSpan timeout) at Microsoft.Fabric.Federation.SiteNode.PerformExternalRingStateStoreOperations(Boolean& canFormRing, Boolean isInsert, Boolean isJoining)} Could someone please provide me some inputs? This is a HA enabled cache environment with 3 cache hosts. All of them are running on Windows Server 2008 Enterprise Edition, and the SQL Server is used for config.

    Read the article

  • How to change by using CVGrayscaleMat

    - by Babul
    With the following code the image showed as above is converted as below image... Their it's showing black background with gray lines.....i want white background with gray lines .. Please guide me .. i am new to iPhone Thanks alot in Advance - (void)viewDidLoad { [super viewDidLoad]; // Initialise video capture - only supported on iOS device NOT simulator #if TARGET_IPHONE_SIMULATOR NSLog(@"Video capture is not supported in the simulator"); #else _videoCapture = new cv::VideoCapture; if (!_videoCapture->open(CV_CAP_AVFOUNDATION)) { NSLog(@"Failed to open video camera"); } #endif // Load a test image and demonstrate conversion between UIImage and cv::Mat UIImage *testImage = [UIImage imageNamed:@"testimage.jpg"]; double t; int times = 10; //-------------------------------- // Convert from UIImage to cv::Mat NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; t = (double)cv::getTickCount(); for (int i = 0; i < times; i++) { cv::Mat tempMat = [testImage CVMat]; } t = 1000 * ((double)cv::getTickCount() - t) / cv::getTickFrequency() / times; [pool release]; NSLog(@"UIImage to cv::Mat: %gms", t); //------------------------------------------ // Convert from UIImage to grayscale cv::Mat pool = [[NSAutoreleasePool alloc] init]; t = (double)cv::getTickCount(); for (int i = 0; i < times; i++) { cv::Mat tempMat = [testImage CVGrayscaleMat]; } t = 1000 * ((double)cv::getTickCount() - t) / cv::getTickFrequency() / times; [pool release]; NSLog(@"UIImage to grayscale cv::Mat: %gms", t); //-------------------------------- // Convert from cv::Mat to UIImage cv::Mat testMat = [testImage CVMat]; t = (double)cv::getTickCount(); for (int i = 0; i < times; i++) { UIImage *tempImage = [[UIImage alloc] initWithCVMat:testMat]; [tempImage release]; } t = 1000 * ((double)cv::getTickCount() - t) / cv::getTickFrequency() / times; NSLog(@"cv::Mat to UIImage: %gms", t); // Process test image and force update of UI _lastFrame = testMat; [self sliderChanged:nil]; } - (IBAction)capture:(id)sender { if (_videoCapture && _videoCapture->grab()) { (*_videoCapture) >> _lastFrame; [self processFrame]; } else { NSLog(@"Failed to grab frame"); } } - (void)processFrame { double t = (double)cv::getTickCount(); cv::Mat grayFrame, output; // Convert captured frame to grayscale cv::cvtColor(_lastFrame, grayFrame, cv::COLOR_RGB2GRAY); // Perform Canny edge detection using slide values for thresholds cv::Canny(grayFrame, output, _lowSlider.value * kCannyAperture * kCannyAperture, _highSlider.value * kCannyAperture * kCannyAperture, kCannyAperture); t = 1000 * ((double)cv::getTickCount() - t) / cv::getTickFrequency(); // Display result self.imageView.image = [UIImage imageWithCVMat:output]; self.elapsedTimeLabel.text = [NSString stringWithFormat:@"%.1fms", t]; }

    Read the article

  • MonoTouch Load image in background

    - by user1058951
    I am having a problem trying to load an image and display it using System.Threading.Task My Code is as follows Task DownloadTask { get; set; } public string Instrument { get; set; } public PriceChartViewController(string Instrument) { this.Instrument = Instrument; DownloadTask = Task.Factory.StartNew(() => { }); } private void LoadChart(ChartType chartType) { NSData data = new NSData(); DownloadTask = DownloadTask.ContinueWith(prevTask => { try { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; NSUrl nsUrl = new NSUrl(chartType.Uri(Instrument)); data = NSData.FromUrl(nsUrl); } finally { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; } }); DownloadTask = DownloadTask.ContinueWith(t => { UIImage image = new UIImage(data); chartImageView = new UIImageView(image); chartImageView.ContentScaleFactor = 2f; View.AddSubview(chartImageView); this.Title = chartType.Title; }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext()); } The second Continue with does not seem to be being called? Initially my code looked like the following without the background processing and it worked perfectly. private void oldLoadChart(ChartType chartType) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; NSUrl nsUrl = new NSUrl(chartType.Uri(Instrument)); NSData data = NSData.FromUrl(nsUrl); UIImage image = new UIImage(data); chartImageView = new UIImageView(image); chartImageView.ContentScaleFactor = 2f; View.AddSubview(chartImageView); this.Title = chartType.Title; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; } Does anyone know what I am doing wrong?

    Read the article

  • backbone model validation error

    - by koko
    I got a validation based on backbone fundamentals by addyosmani, but when i try it on my view i can't get the error that the model generated.TIA model.js validate: function(attrs) { var errors = this.errors = {}; if (!attrs.box) errors.box= 'box value is required'; //console.log(errors.box); if (!_.isEmpty(errors)) return errors; } view.js validate: function(model) { console.log("error text--" + model.errors[this.input] || ''); },

    Read the article

  • Setup sonar-runner for multiple java projects

    - by zetafish
    I am trying to run sonar-runner to analyze multiple Java projects in one go. According to the documentation http://docs.codehaus.org/display/SONAR/Analyse+with+a+simple+Java+Runner it is just a matter of creating a sonar-project.properties file for each project. But it is not clear to me where exactly I have to put these sonar-project.properties files. I tried to add multiple .properties files in the $SONAR_RUNNER_HOME/conf folder but the runner does not seem to pick them up. It only sees the sonar-project.properties file. Any suggestions on how to run sonar-runner for multiple projects?

    Read the article

  • JNI: Passing multiple parameters in the function signature for GetMethodID

    - by Jary
    I am trying to execute a function in Java (from C) that has the following signature: public void execute(int x, int y, int action); My problem is to define the function signature in GetMethodID: env->GetMethodID(hostClass, "execute", "(I;I;I;)V"); The problem I ma getting is: W/dalvikvm( 1849): Bogus method descriptor: (I;I;I;)V W/dalvikvm( 1849): Bogus method descriptor: (I;I;I;)V D/dalvikvm( 1849): GetMethodID: method not found: Lcom/device/client/HostConnection;.execute:(I;I;I;)V I am not sure how to specify the method signature in GetMethodID (for 3 integers as parameters). I saw people use the ";" to separate parameters in other posts for the String and File class, but nothing with primitives like integer. What would be the correct way to do this please? Thank you.

    Read the article

  • android button setPressed after onClick

    - by strem
    yesterday I noticed the possibility to integrate Fragments in older API Levels through the Compatibility package, but thats not really essential for the question. :) I have a Button with an OnClickListener Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { doSomething(); button.setPressed(true); } }); Because of the actual clicking, it is shown as pressed and after releasing the click, the button state is not pressed and stays that way. Is there a simple way that keeps the button state pressed after releasing? First thing I can think of would be some sort of timer, but that seems unreasonable.

    Read the article

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