Search Results

Search found 5136 results on 206 pages for 'comment bot'.

Page 172/206 | < Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >

  • Getting the full-name of the current user, returns an empty string (C#/C++)

    - by Nir
    I try to get the full-name of the current log-in user (Fullname, not username). The following code C#, C++ works fine but on XP computers not connected to the Net, I get empty string as result if I run it ~20 minutes after login (It runs OK whithin the first ~20 minutes after login) A Win32 API (GetUserNameEx) is used rather that PrincipalContext since it PrincipalContext may takes up to 15 seconds when working offline. Any Help why am I getting an empty string as result though a user full name is specified??? - C# Code public static string CurrentUserFullName { get { const int EXTENDED_NAME_FORMAT_NAME_DISPLAY = 3; StringBuilder userName = new StringBuilder(256); uint length = (uint) userName.Capacity; string ret; if (GetUserNameEx(EXTENDED_NAME_FORMAT_NAME_DISPLAY, userName, ref length)) { ret = userName.ToString(); } else { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception("GetUserNameEx Failed. Error code - " + errorCode); } return ret; } } [DllImport("Secur32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern bool GetUserNameEx(int nameFormat, StringBuilder lpNameBuffer, ref uint lpnSize); - Code in C++ #include "stdafx.h" #include <windows.h> #define SECURITY_WIN32 #include <Security.h> #pragma comment( lib, "Secur32.lib" ) int _tmain(int argc, _TCHAR* argv[]) { char szName[100]; ULONG nChars = sizeof( szName ); if ( GetUserNameEx( NameDisplay, szName, &nChars ) ) { printf( "Name: %s\n", szName); } else { printf( "Failed to GetUserNameEx\n" ); printf( "%d\n", GetLastError() ); } return 0; }

    Read the article

  • How do I post a link to the feed of a page via the Facebook Graph API *as* the page?

    - by jsdalton
    I'm working on a plugin for a Wordpress blog that posts a link to every article published to a Facebook Page associated with the blog. I'm using the Graph API and I have authenticated myself, for the time being, via OAuth. I can successfully post a message to the page using curl via a POST request to https://graph.facebook.com/mypageid/feed with e.g. message = "This is a test" and it published the message. The problem is that the message is "from" my user account. I'm an admin on this test page, and when I go to Facebook and post an update from the web, the link comes "from" my page. That's how I'd like this to be set up, because it looks silly if all the shared links are coming from a user account. Is there a way to authenticate myself as a page? Or is there an alternate way to POST to a page feed that doesn't end up being interpreted as a comment from a user? Thanks for any thoughts or suggestions.

    Read the article

  • an algorhithm for filtering out raw txt files

    - by Roman Luštrik
    Imagine you have a .txt file of the following structure: >>> header >>> header >>> header K L M 200 0.1 1 201 0.8 1 202 0.01 3 ... 800 0.4 2 >>> end of file 50 0.1 1 75 0.78 5 ... I would like to read all the data except lines denoted by >>> and lines below the >>> end of file line. So far I've solved this using read.table(comment.char = ">", skip = x, nrow = y) (x and y are currently fixed). This reads the data between the header and >>> end of file. However, I would like to make my function a bit more plastic regarding the number of rows. Data may have values larger than 800, and consequently more rows. I could scan or readLines the file and see which row corresponds to the >>> end of file and calculate the number of lines to be read. What approach would you use?

    Read the article

  • Silverlight: Button template with texttrimming cut off

    - by dex3703
    I'm replacing the default Button template's ContentPresenter with a TextBlock, so the text can be trimmed when it's too long. Works fine in WPF. In Silverlight the text gets pushed to one edge and cut off on the left, even when there's space on the right: Template is nothing special, just replaced the ContentPresenter with the TextBlock: <Border x:Name="bdrBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" /> <Rectangle x:Name="rectMouseOverVisualElement" Opacity="0"> <Rectangle.Fill> <SolidColorBrush x:Name="rectMouseOverColor" Color="{StaticResource MouseOverItemBgColor}"/> </Rectangle.Fill> </Rectangle> <Rectangle x:Name="rectPressedVisualElement" Opacity="0" Style="{TemplateBinding Tag}"/> <TextBlock x:Name="textblock" Text="{TemplateBinding Content}" TextTrimming="WordEllipsis" TextWrapping="NoWrap" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> <Rectangle x:Name="rectDisabledVisualElement" Opacity="0" Style="{StaticResource RectangleDisabledStyle}"/> <Rectangle x:Name="rectFocusVisualElement" Opacity="0" Style="{StaticResource RectangleFocusStyle}"/> </Grid> </ControlTemplate> How do I fix this? More info: With the latest comment about HorizontalAlignment, it's clear that SL's implementation of TextTrimming differs from WPF's. In SL, TextTrimming only really works if the text is aligned left. SL isn't smart enough to align the text the way WPF does. For instance: WPF button: SL button with the textblock horizontalalignment = left: SL button with textblock horizontalalignment = center:

    Read the article

  • ASP.Net MVC: Change Routes dynamically

    - by Frank
    Hi, usually, when I look at a ASP.Net MVC application, the Route table gets configured at startup and is not touched ever after. I have a couple of questions on that but they are closely related to each other: Is it possible to change the route table at runtime? How would/should I avoid threading issues? Is there maybe a better way to provide a dynamic URL? I know that IDs etc. can appear in the URL but can't see how this could be applicable in what I want to achieve. How can I avoid that, even though I have the default controller/action route defined, that default route doesn't work for a specific combination, e.g. the "Post" action on the "Comments" controller is not available through the default route? Background: Comment Spammers usually grab the posting URL from the website and then don't bother to go through the website anymore to do their automated spamming. If I regularly modify my post URL to some random one, spammers would have to go back to the site and find the correct post URL to try spamming. If that URL changes constantly I'd think that that could make the spammers' work more tedious, which should usually mean that they give up on the affected URL.

    Read the article

  • How to convert a lambda to an std::function using templates

    - by retep998
    Basically, what I want to be able to do is take a lambda with any number of any type of parameters and convert it to an std::function. I've tried the following and neither method works. std::function([](){});//Complains that std::function is missing template parameters template <typename T> void foo(function<T> f){} foo([](){});//Complains that it cannot find a matching candidate The following code does work however, but it is not what I want because it requires explicitly stating the template parameters which does not work for generic code. std::function<void()>([](){}); I've been mucking around with functions and templates all evening and I just can't figure this out, so any help would be much appreciated. As mentioned in a comment, the reason I'm trying to do this is because I'm trying to implement currying in C++ using variadic templates. Unfortunately, this fails horribly when using lambdas. For example, I can pass a standard function using a function pointer. template <typename R, typename...A> void foo(R (*f)(A...)) {} void bar() {} int main() { foo(bar); } However, I can't figure out how to pass a lambda to such a variadic function. Why I'm interested in converting a generic lambda into an std::function is because I can do the following, but it ends up requiring that I explicitly state the template parameters to std::function which is what I am trying to avoid. template <typename R, typename...A> void foo(std::function<R(A...)>) {} int main() { foo(std::function<void()>([](){})); }

    Read the article

  • Programatically adding,changing and removing controls bound to model objects (MVVM)

    - by Ittai
    I have the following scenario and I'm trying to decide how it can and should be implemented in silverlight and c# via MVVM. Scenario: I have the following objects in my scenario: MyModel, MyModelControl, MyView and MyViewModel. MyModelcontrol is a custom UserControl of mine and the rest I think are pretty much self explanatory. MyViewModel is a Subscriber of a message which hands it a Collection<MyModel> newCol and let's mark curCol as the current Collection<MyModel> that MyViewModel holds. I then want to programatically add MyModelControl controls for each MyModel instance which belongs to newCol and not to curCol. I also want to bind the MyModelControl instance to the corresponding MyModel instance. In a similar manner I want to remove the controls which don't belong now to the collection and I want to update a property for those which belong to both. I do not want to remove all controls which belong to curCol and then add all controls for newCol as the creation of MyModelControl is "expensive". I'd appreciate help with how this should be implemented in SL as I'm new to it and to the MVVM pattern. Comments regarding the design would also be welcomed. B.T.W This will run on Windows Phone 7 so I think there are some limitations on versions, if this is an issue please comment and I'll verify which versions exactly I can use on the phone.

    Read the article

  • Determine asymmetric latencies in a network

    - by BeeOnRope
    Imagine you have many clustered servers, across many hosts, in a heterogeneous network environment, such that the connections between servers may have wildly varying latencies and bandwidth. You want to build a map of the connections between servers my transferring data between them. Of course, this map may become stale over time as the network topology changes - but lets ignore those complexities for now and assume the network is relatively static. Given the latencies between nodes in this host graph, calculating the bandwidth is a relative simply timing exercise. I'm having more difficulty with the latencies - however. To get round-trip time, it is a simple matter of timing a return-trip ping from the local host to a remote host - both timing events (start, stop) occur on the local host. What if I want one-way times under the assumption that the latency is not equal in both directions? Assuming that the clocks on the various hosts are not precisely synchronized (at least that their error is of the the same magnitude as the latencies involved) - how can I calculate the one-way latency? In a related question - is this asymmetric latency (where a link is quicker in direction than the other) common in practice? For what reasons/hardware configurations? Certainly I'm aware of asymmetric bandwidth scenarios, especially on last-mile consumer links such as DSL and Cable, but I'm not so sure about latency. Added: After considering the comment below, the second portion of the question is probably better off on serverfault.

    Read the article

  • Performance Problems with Django's F() Object

    - by JayhawksFan93
    Has anyone else noticed performance issues using Django's F() object? I am running Windows XP SP3 and developing against the Django trunk. A snippet of the models I'm using and the query I'm building are below. When I have the F() object in place, each call to a QuerySet method (e.g. filter, exclude, order_by, distinct, etc.) takes approximately 2 seconds, but when I comment out the F() clause the calls are sub-second. I had a co-worker test it on his Ubuntu machine, and he is not experiencing the same performance issues I am with the F() clause. Anyone else seeing this behavior? class Move (models.Model): state_meaning = models.CharField( max_length=16, db_index=True, blank=True, default='' ) drop = models.ForeignKey( Org, db_index=True, null=False, default=1, related_name='as_move_drop' ) class Split(models.Model): state_meaning = models.CharField( max_length=16, db_index=True, blank=True, default='' ) move = models.ForeignKey( Move, related_name='splits' ) pickup = models.ForeignKey( Org, db_index=True, null=False, default=1, related_name='as_split_pickup' ) pickup_date = models.DateField( null=True, default=None ) drop = models.ForeignKey( Org, db_index=True, null=False, default=1, related_name='as_split_drop' ) drop_date = models.DateField( null=True, default=None, db_index=True ) def get_splits(begin_date, end_date): qs = Split.objects \ .filter(state_meaning__in=['INPROGRESS','FULFILLED'], drop=F('move__drop'), # <<< the line in question pickup_date__lte=end_date) elapsed = timer.clock() - start print 'qs1 took %.3f' % elapsed start = timer.clock() qs = qs.filter(Q(drop_date__gte=begin_date) | Q(drop_date__isnull=True)) elapsed = timer.clock() - start print 'qs2 took %.3f' % elapsed start = timer.clock() qs = qs.exclude(move__state_meaning='UNFULFILLED') elapsed = timer.clock() - start print 'qs3 took %.3f' % elapsed start = timer.clock() qs = qs.order_by('pickup_date', 'drop_date') elapsed = timer.clock() - start print 'qs7 took %.3f' % elapsed start = timer.clock() qs = qs.distinct() elapsed = timer.clock() - start print 'qs8 took %.3f' % elapsed

    Read the article

  • NSMutableArray for Object which has NSString property causes memory leak

    - by user262325
    Hello everyone I hope to add objects to a NSMutableArray "myArray", The NSMutableArray is the array for FileObj which has a NSString property "fileName" #import <UIKit/UIKit.h> @interface FileObj : NSObject { NSString *fileName; } -(void) setfileName:(NSString *)s ; -(NSString *) getfileName ; @end // // File.m// #import "File.h" @implementation FileObj -(void) setfileName:(NSString *)s ; { fileName=s; } -(NSString *) getfileName ; { return fileName; } @end I initialize the myArray here: NSMutableArray *temarray; temarray=[[NSMutableArray alloc] init]; self.myArray=temarray; [temarray release]; the codes to add object to myArray FileObj *newobj=[[FileObj alloc]init ]; NSString *fieldValue2 = [[NSString alloc] initWithUTF8String:@"aaaa"]; [newobj setfileName:fieldValue2]; [myArray addObject:newobj]; [fieldValue2 release]; //**if I enabled the line, it will cause crash** //**if I disable the line, it will cause memory leak** [newobj release]; Welcome any comment Thanks interdev

    Read the article

  • Measuring the CPU frequency scaling effect

    - by Bryan Fok
    Recently I am trying to measure the effect of the cpu scaling. Is it accurate if I use this clock to measure it? template<std::intmax_t clock_freq> struct rdtsc_clock { typedef unsigned long long rep; typedef std::ratio<1, clock_freq> period; typedef std::chrono::duration<rep, period> duration; typedef std::chrono::time_point<rdtsc_clock> time_point; static const bool is_steady = true; static time_point now() noexcept { unsigned lo, hi; asm volatile("rdtsc" : "=a" (lo), "=d" (hi)); return time_point(duration(static_cast<rep>(hi) << 32 | lo)); } }; Update: According to the comment from my another post, I believe redtsc cannot use for measure the effect of cpu frequency scaling because the counter from the redtsc does not affected by the CPU frequency, am i right?

    Read the article

  • Can't display image with Imageview on Android

    - by user1029167
    In my \drawable-mdpi folder, I have an image named: test.jpg In my main.xml file, in my LinearLayout section, I have: <ImageView android:id="@+id/test_image" android:src="@drawable/test" android:layout_width="wrap_content" android:layout_height="wrap_content" /> In my src folder, I have only 1 file, HelloAndroidActivity.java with only the following method: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView image = new ImageView(this); image = (ImageView) findViewById(R.id.test_image); setContentView(image); } This seems to be correct, yet whenever I try to run it, I get The application HelloAndroid (process xxxxx) has stopped unexpectedly. Please try again. The strange part is it previously did display the image, but now it won't and I don't know why. Also, when I comment out the ImageDisplay code, and replace it with TextDisplay code. i.e. TextView tv = new TextView(this); tv.setText("Does this work?"); setContentView(tv); It does display the text. Edit: was asked to post logcat. Link to pastebin.

    Read the article

  • How is the C++ synthesized move constructor affected by volatile and virtual members?

    - by user1827766
    Look at the following code: struct node { node(); //node(const node&); //#1 //node(node&&); //#2 virtual //#3 ~node (); node* volatile //#4 next; }; main() { node m(node()); //#5 node n=node(); //#6 } When compiled with gcc-4.6.1 it produces the following error: g++ -g --std=c++0x -c -o node.o node.cc node.cc: In constructor node::node(node&&): node.cc:3:8: error: expression node::next has side-effects node.cc: In function int main(): node.cc:18:14: note: synthesized method node::node(node&&) first required here As I understand the compiler fails to create default move or copy constructor on line #6, if I uncomment either line #1 or #2 it compiles fine, that is clear. The code compiles fine without c++0x option, so the error is related to default move constructor. However, what in the node class prevents default move constructor to be created? If I comment any of the lines #3 or #4 (i.e. make the destructor non-virtual or make data member non-volatile) it compiles again, so is it the combination of these two makes it not to compile? Another puzzle, line #5 does not cause an compilation error, what is different from line #6? Is it all specific for gcc? or gcc-4.6.1?

    Read the article

  • Waiting until one event has happened before moving onto the next.

    - by jaasum
    I currently have a scrolling anchor animation that also adds an "active" class to the anchor clicked. I am trying to fit the below function into the works as well, so say someone clicks "anchor 1", "anchor 1" will get an active class and the window will scroll to that location. But, after that has happened say the user manually begins scrolling down the page, I want the active class to be removed. The problem I am running up against now is that the below function will happen when the scrolling animation from a clicked anchor is taking place. How can I disable this only when the window is being scrolled from a clicked anchor? $(window).scroll(function() { $('a[href^=#]').removeClass('active'); }); Here is the scrolling anchor script I am working with. /******* *** Anchor Slider by Cedric Dugas *** *** Http://www.position-absolute.com *** Never have an anchor jumping your content, slide it. Don't forget to put an id to your anchor ! You can use and modify this script for any project you want, but please leave this comment as credit. *****/ jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 500 }, settings); return this.each(function(){ var caller = this $(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = $(caller).attr("href") var destination = $(elementClick).offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, 'easeOutCubic', function() { window.location.hash = elementClick }); return false; }) }) } And lastly, my jQuery // Scrolling Anchors $('[href^=#]').anchorAnimate(); // Active Class For Clicked Anchors var anchorscroll = $('a[href^=#]') anchorscroll.click(function(){ var anchorlocation = $(this).attr("href"); anchorscroll.removeClass('active'); $(this).addClass('active'); $('a[href='+anchorlocation+']').addClass('active'); });

    Read the article

  • casting char[][] to char** causes segfault?

    - by Earlz
    Ok my C is a bit rusty but I figured I'd make my next(small) project in C so I could polish back up on it and less than 20 lines in I already have a seg fault. This is my complete code: #define ROWS 4 #define COLS 4 char main_map[ROWS][COLS+1]={ "a.bb", "a.c.", "adc.", ".dc."}; void print_map(char** map){ int i; for(i=0;i<ROWS;i++){ puts(map[i]); //segfault here } } int main(){ print_map(main_map); //if I comment out this line it will work. puts(main_map[3]); return 0; } I am completely confused as to how this is causing a segfault. What is happening when casting from [][] to **!? That is the only warning I get. rushhour.c:23:3: warning: passing argument 1 of ‘print_map’ from incompatible pointer type rushhour.c:13:7: note: expected ‘char **’ but argument is of type ‘char (*)[5]’ Are [][] and ** really not compatible pointer types? They seem like they are just syntax to me.

    Read the article

  • java label setText and setBounds clashing?

    - by java
    I would like to have a JLabel changint color to a random one, while jumping to a random position, and while changing its text. but the setText and setBounds seem to clash and i don't know why. if you comment out the setText then the setBounds will work, but they won't work together. import java.awt.*; import java.util.*; import javax.swing.*; public class test2 extends JFrame { private static JLabel label = new JLabel("0"); private static Random gen = new Random(); public test2() { JPanel panel = new JPanel(); panel.add(label); this.add(panel); } public static void move() { for (int i = 0; i < 10; i++) { int n = gen.nextInt(254)+1; int nn = gen.nextInt(254)+1; int nnn = gen.nextInt(254)+1; label.setText(""+i); //the setBounds command will not work with the setText command. why? label.setBounds(n*2, nn*2, 20, 20); label.setForeground(new Color(n, nn, nnn)); try { Thread.sleep(200); } catch (Exception e) {} } } public static void main(String[] args) { test2 frame = new test2(); frame.setVisible(true); frame.setSize(600, 600); frame.setResizable(true); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); move(); } }

    Read the article

  • Linq to Entities Joins

    - by Bob Avallone
    I have a question about joins when using Linq to Entities. According to the documentation the use on the join without a qualifier performs like a left outer join. However when I execute the code below, I get a count returned of zero. But if I comment out the three join lines I get a count of 1. That would indicate that the join are acting as inner join. I have two questions. One which is right inner or outer as the default? Second how do I do the other one i.e. inner or outer? The key words on inner and outer do not work. var nprs = (from n in db.FMCSA_NPR join u in db.FMCSA_USER on n.CREATED_BY equals u.ID join t in db.LKUP_NPR_TYPE on n.NPR_TYPE_ID equals t.ID join s in db.LKUP_AUDIT_STATUS on n.NPR_STATUS_ID equals s.ID where n.ROLE_ID == pRoleId && n.OWNER_ID == pOwnerId && n.NPR_STATUS_ID == pNPRStatusId && n.ACTIVE == pActive select n).ToList(); if (nprs.Count() == 0) return null;

    Read the article

  • Asp.Net MVC3 - How create Dynamic DropDownList

    - by Bibo
    I found many articles on this but still I don´t know how exactly to do this. I am trying to create my own blog engine, I have View for create article (I am using EF and Code first) and now I must fill number of category in which article should be add but I want to change it to dropdownlist with names of categories. My model looks this: public class Article { public int ArticleID { get; set; } [Required] public string Title { get; set; } [Required] public int CategoryID { get; set; } public DateTime Date { get; set; } [Required()] [DataType(DataType.MultilineText)] [AllowHtml] public string Text { get; set; } public virtual Category Category { get; set; } public IEnumerable<SelectListItem> Categories { get; set; } public virtual ICollection<Comment> Comments { get; set; } } public class Category { public int CategoryID { get; set; } [Required] public string Name { get; set; } public virtual ICollection<Article> Articles { get; set; } } I know I must use Enum (or I think) but I am not exactly sure how. I don´t know which tutorial from that I found is best for me.

    Read the article

  • How to get the real, actual duration of an MP3 file (VBR or CBR) server-side

    - by Cummander Checkov
    I used to calculate the duration of MP3 files server-side using ffmpeg - which seemed to work fine. Today i discovered that some of the calculations were wrong. Somehow, for some reason, ffmpeg will miscalculate the duration and it seems to happen with variable bit rate mp3 files only. When testing this locally, i noticed that ffmpeg printed two extra lines in green. Command used: ffmpeg -i song_9747c077aef8.mp3 ffmpeg says: [mp3 @ 0x102052600] max_analyze_duration 5000000 reached at 5015510 [mp3 @ 0x102052600] Estimating duration from bitrate, this may be inaccurate After a nice, warm google session, i found some posts on this, but no solution was found. I then tried to increase the maximum duration: ffmpeg -analyzeduration 999999999 -i song_9747c077aef8.mp3 After this, ffmpeg returned only the second line: [mp3 @ 0x102052600] Estimating duration from bitrate, this may be inaccurate But in either case, the calculated duration was just plain wrong. Comparing it to VLC i noticed that here the duration is correct. After more research i stumbled over mp3info - which i installed and used. mp3info -p "%S" song_9747c077aef8.mp3 mp3info then returned the CORRECT duration, but only as an integer, which i cannot use as i need a more accurate number here. The reason for this was explained in a comment below, by user blahdiblah - mp3info is simply pulling ID3 info from the file and not actually performing any calculations. I also tried using mplayer to retrieve the duration, but just as ffmpeg, mplayer is returning the wrong value. Now i ran out of options. If somebody knows how to get around this, any hints, tips, guides or corrections are welcome! Thank You!

    Read the article

  • Very fast document similarity

    - by peyton
    Hello, I am trying to determine document similarity between a single document and each of a large number of documents (n ~= 1 million) as quickly as possible. More specifically, the documents I'm comparing are e-mails; they are grouped (i.e., there are folders or tags) and I'd like to determine which group is most appropriate for a new e-mail. Fast performance is critical. My a priori assumption is that the cosine similarity between term vectors is appropriate for this application; please comment on whether this is a good measure to use or not! I have already taken into account the following possibilities for speeding up performance: Pre-normalize all the term vectors Calculate a term vector for each group (n ~= 10,000) rather than each e-mail (n ~= 1,000,000); this would probably be acceptable for my application, but if you can think of a reason not to do it, let me know! I have a few questions: If a new e-mail has a new term never before seen in any of the previous e-mails, does that mean I need to re-compute all of my term vectors? This seems expensive. Is there some clever way to only consider vectors which are likely to be close to the query document? Is there some way to be more frugal about the amount of memory I'm using for all these vectors? Thanks!

    Read the article

  • Slow query. Wrong database structure?

    - by Tin
    I have a database with table that contains tasks. Tasks have a lifecycle. The status of the task's lifecycle can change. These state transitions are stored in a separate table tasktransitions. Now I wrote a query to find all open/reopened tasks and recently changed tasks but I already see with a rather small number of tasks (<1000) that execution time has becoming very long (0.5s). Tasks +-------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------+------+-----+---------+----------------+ | taskid | int(11) | NO | PRI | NULL | auto_increment | | description | text | NO | | NULL | | +-------------+---------+------+-----+---------+----------------+ Tasktransitions +------------------+-----------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+-----------+------+-----+-------------------+----------------+ | tasktransitionid | int(11) | NO | PRI | NULL | auto_increment | | taskid | int(11) | NO | MUL | NULL | | | status | int(11) | NO | MUL | NULL | | | description | text | NO | | NULL | | | userid | int(11) | NO | | NULL | | | transitiondate | timestamp | NO | | CURRENT_TIMESTAMP | | +------------------+-----------+------+-----+-------------------+----------------+ Query SELECT tasks.taskid,tasks.description,tasklaststatus.status FROM tasks LEFT OUTER JOIN ( SELECT tasktransitions.taskid,tasktransitions.transitiondate,tasktransitions.status FROM tasktransitions INNER JOIN ( SELECT taskid,MAX(transitiondate) AS lasttransitiondate FROM tasktransitions GROUP BY taskid ) AS tasklasttransition ON tasklasttransition.lasttransitiondate=tasktransitions.transitiondate AND tasklasttransition.taskid=tasktransitions.taskid ) AS tasklaststatus ON tasklaststatus.taskid=tasks.taskid WHERE tasklaststatus.status IS NULL OR tasklaststatus.status=0 or tasklaststatus.transitiondate>'2013-09-01'; I'm wondering if the database structure is best choice performance wise. Could adding indexes help? I already tried to add some but I don't see great improvements. +-----------------+------------+----------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +-----------------+------------+----------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | tasktransitions | 0 | PRIMARY | 1 | tasktransitionid | A | 896 | NULL | NULL | | BTREE | | | | tasktransitions | 1 | taskid_date_ix | 1 | taskid | A | 896 | NULL | NULL | | BTREE | | | | tasktransitions | 1 | taskid_date_ix | 2 | transitiondate | A | 896 | NULL | NULL | | BTREE | | | | tasktransitions | 1 | status_ix | 1 | status | A | 3 | NULL | NULL | | BTREE | | | +-----------------+------------+----------------+--------------+------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ Any other suggestions?

    Read the article

  • Can't store UTF-8 in RDS despite setting up new Parameter Group using Rails on Heroku

    - by Lail
    I'm setting up a new instance of a Rails(2.3.5) app on Heroku using Amazon RDS as the database. I'd like to use UTF-8 for everything. Since RDS isn't UTF-8 by default, I set up a new Parameter Group and switched the database to use that one, basically per this. Seems to have worked: SHOW VARIABLES LIKE '%character%'; character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server utf8 character_set_system utf8 character_sets_dir /rdsdbbin/mysql-5.1.50.R3/share/mysql/charsets/ Furthermore, I've successfully setup Heroku to use the RDS database. After rake db:migrate, everything looks good: CREATE TABLE `comments` ( `id` int(11) NOT NULL AUTO_INCREMENT, `commentable_id` int(11) DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, `content` text COLLATE utf8_unicode_ci, `child_count` int(11) DEFAULT '0', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `commentable_id` (`commentable_id`), KEY `index_comments_on_community_id` (`community_id`), KEY `parent_id` (`parent_id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; In the markup, I've included: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Also, I've set: production: encoding: utf8 collation: utf8_general_ci ...in the database.yml, though I'm not very confident that anything is being done to honor any of those settings in this case, as Heroku seems to be doing its own config when connecting to RDS. Now, I enter a comment through the form in the app: "Úbe® ƒåiL", but in the database I've got "Úbe® Æ’Ã¥iL" It looks fine when Rails loads it back out of the database and it is rendered to the page, so whatever it is doing one way, it's undoing the other way. If I look at the RDS database in Sequel Pro, it looks fine if I set the encoding to "UTF-8 Unicode via Latin 1". So it seems Latin-1 is sneaking in there somewhere. Somebody must have done this before, right? What am I missing?

    Read the article

  • FileSystemWatcher Work is Done?

    - by Snowy
    I setup a FsWatcher on a local filesystem directory. I only want to know when files are added to the directory so they can be moved to another filesystem. I seem to be able to detect when the first file is in, but actually I want to know when all files from a given copy operation are done. If I used Windows Explorer to copy files from one directory to another, Explorer would tell me that there are n seconds left in the transfer, so while there is some activity for the begin-transfer and end-transfer for each file, it appears that there is something for the begin-transfer and end-transfer for all files. I wonder if there is something similar that I can do just with the .NET Framework. I would like to know when "all" files are in and not just a single file in a "transaction". If there is nothing baked in, maybe I should come up with some kind of waiting/countering in order to only do my activity when a job is "done". Not sure if I'm making 100% sense on this one, please anyone comment. Thanks.

    Read the article

  • DLL Export C/C++ 6.00 function invoked by VB6

    - by nashth
    Hi all, I have been attemptng to create a DLL with C/C++ that can be accessed by VB6, and that's right I get error "453 Can't find DLL entry point myFunctionName in myDllName.dll" upon calling the function from a VB6 app. After searching the Web, including this site, I see that I am not alone, and I have tried the various solutions posted but error "453" is unexcapable. This is Not a COMM dll, and I believe that is possible when created via C/C++. In any case, please help, if you can. Please refer to the following simple test case below: The DLL created as a C/C++ 6.00 Win32 Dynamic-Link Library: #include // Note that I did try the line below rather than the def file, but to no avail... // #pragma comment(linker, "/EXPORT:ibask32=_ibask32@0") // Function definition extern "C" int __declspec(dllexport) __stdcall ibask32() { MessageBox(NULL,"String","Sample Code", NULL); return 0L; } The def file: LIBRARY "Gpib-32" EXPORTS ibask32 Now for the VB App: The following is the entire content of the startup Form1, Form_Load Option Explicit Private Sub Form_Load() Call ibask End Sub The following is a BAS module file that is added to the project: Option Explicit Declare Function ibask32 Lib "Gpib-32.dll" Alias "ibask" () As Long Sub ibask() Call ibask32 ' Note: This is the point of failure End Sub Thanks in advance if a workable solution can be provided, Tom

    Read the article

  • PHP Pass Dynamic Array name to function

    - by Brad
    How do I pass an array key to a function to pull up the right key's data? // The array <?php $var['TEST1'] = Array ( 'Description' => 'This is a Description', 'Version' => '1.11', 'fields' => Array( 'ID' => array( 'type' => 'int', 'length' =>'11', 'misc' =>'auto_increment' ), 'DATA' => array( 'type' => 'varchar', ' length' => '255' ) ); $var['TEST2'] = Array ( 'Description' =? 'This is the 2nd Description', 'Version' => '2.1', 'fields' => Array( 'ID' => array( 'type' => 'int', 'length' =>'11', 'misc' =>'auto_increment' ), 'DATA' => array( 'type' => 'varchar', ' length' => '255' ) ) // The function <?php $obj = 'TEST1'; print_r($schema[$obj]); // <-- Fives me output. But calling the function doesn't. echo buildStructure($obj); /** * @TODO to add auto_inc support */ function buildStructure($obj) { $output = ''; $primaryKey = $schema["{$obj}"]['primary key']; foreach ($schema["{$obj}"]['fields'] as $name => $tag) // #### ERROR #### Invalid argument supplied for foreach() { $type = $tag['type']; $length = $tag['length']; $default = $tag['default']; $description = $tag['description']; $length = (isset($length)) ? "({$length})" : ''; $default = ($default == NULL ) ? "NULL" : $default; $output .= "`{$name}` {$type}{$length} DEFAULT {$default} COMMENT `{$DESCRIPTION}`, "; } return $output; }

    Read the article

< Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >