Daily Archives

Articles indexed Wednesday March 31 2010

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

  • Rails: foreign_key that is set with a CASE WHEN mysql statement

    - by user305270
    belongs_to :removed_friend, :class_name => 'Profile', :foreign_key => "(CASE WHEN friendships.profile_id = #{self.id} THEN friendships.friend_id ELSE friendships.profile_id END)" The self.id its not working too :s it should be the id of the profile that is triggered the action. Anyway the main problem is that this foreign_key is not working and i got a mysql error. please help.. thanks

    Read the article

  • WPF Storyboard flicker issue

    - by Vinjamuri
    With the code below, the control flickers whenever the image is changed for MouseOver/MousePressed? I am using Storyboard and Double animation.The image display is very smooth with WPF Triggers but not with Storyboard. Can anyone help me to fix this issue? <Style TargetType="{x:Type local:ButtonControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:ButtonControl}"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgNormal" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgOver" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:Name="Disabled"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgDisable" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:Name="Pressed"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgPress" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Border x:Name="imgNormal" Opacity="0"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NormalImage}" Stretch="UniformToFill"/> </Border> </Grid> <Grid> <Border x:Name="imgOver" Opacity="0"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MouseOverImage}" Stretch="UniformToFill"/> </Border> </Grid> <Grid> <Border x:Name="imgDisable" Opacity="0"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DisableImage}" Stretch="UniformToFill"/> </Border> </Grid> <Grid> <Border x:Name="imgPress" Opacity="0"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MousePressImage}" Stretch="UniformToFill"/> </Border> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • regular expression to find all cell addresses in string

    - by Nike
    I have a string which may contain cell address, which is look like: A1, B34, Z728 - only capital letters and AA3, ABA92, ZABC83 - there may be several letters before Integer number. The typical source string is look like: =3+7*A1-B3*AB28 I need to get collection of all cells in the string: A1, B3, AB28 I tried to use Regex.Matches method with the following regular expression: @"[A..Z]+?[1..9]+?", but it doesn't work. Can anybody help me to write the regular expression?

    Read the article

  • Draw a line in crystal report

    - by Aniruddha
    I want to draw a line in Crystal report. I can do that from a sub-menu but this line I need to draw in a Group section Field object with a background color property set to some color. So whenever I draw a line it gets overlapped by this FieldObject. How can I make sure that line would be visible over the background color of object?

    Read the article

  • How to use Excel VBA to extract Memo field from Access Database?

    - by the.jxc
    I have an Excel spreadsheet. I am connecting to an Access database via ODBC. Something along then lines of: Set dbEng = CreateObject("DAO.DBEngine.40") Set oWspc = dbEng.CreateWorkspace("ODBCWspc", "", "", dbUseODBC) Set oConn = oWspc.OpenConnection("Connection", , True, "ODBC;DSN=CLIENTDB;") Then I use a query and fetch a result set to get some table data. Set oQuery = oConn.CreateQueryDef("tmpQuery") oQuery.Sql = "SELECT idField, memoField FROM myTable" Set oRs = oQuery.OpenRecordset The problem now arises. My field is a dbMemo because the maximum content length is up to a few hundred chars. It's not that long, and in fact the value I'm reading is only a dozen characters. But Excel just doesn't seem able to handle the Memo field content at all. My code... ActiveCell = oRs.Fields("memoField") ...gives error Run-time error '3146': ODBC--call failed. Any suggestions? Can Excel VBA actually get at memo field data? Or is it just completely impossible. I get exactly the same error from GetChunk as well. ActiveCell = oRs.Fields("memoField").GetChunk(0, 2) ...also gives error Run-time error '3146': ODBC--call failed. Converting to a text field makes everything work fine. However some data is truncated to 255 characters of course, which means that isn't a workable solution.

    Read the article

  • All GIT Repos Corrupted on System Restore

    - by yar
    I restored my OSX today by copying the system over from a backup. Most things seem to be working, but every single GIT repo gives pretty much the same error fatal: object 03b45161eb27228914e690e032ca8009358e9588 is corrupted I have tried chowning, doing everything as sudo or root... I have no idea what to try next. This would be a normal git question except that it's on many repos. Ideas? Note: I'm using git 1.7.0.3 and I was probably using 1.7.0 before.

    Read the article

  • Django pagination | get current index of paginated item in page index, (not the page index range its

    - by cka
    I am trying to build a photo gallery with Django. It is set up by category. I have paginated the results of a category by n amount of images per page. I want to also use the paginator on the page that shows just the single image and have a prev/next button for the prev/next image in that category. My thought was to get the current index for the image itself and have that be the link to the /category/CUR_IMG_ID_PAGINATION_LIST/ as the result of paginating the entire set would yield the same index as the current image index in the paginated results. For instance if the image i want is image 45 out of 150 images total for a category, then when i paginate the 150 images the 45 will be the actual number of the page I want. If there's an easier way to do this, let me know. Django 1.1

    Read the article

  • Load image in device independent and screen independent fashion into a layout view using 1.6 SDK

    - by Mark Wigzell
    I'm having trouble getting an asset image to scale up when I load it. The new call to BitmapDrawable(Resources, BitmapDrawable) is not available on 1.6 SDK. Is there a workaround to load the BitmapDrawable the old way and then somehow manipulate it? I have tried calling setTargetDensity() to no avail. My code (which doesn't scale properly) is: ImageView iv = (ImageView)view.findViewById(R.id.image); iv.setImageDrawable(new BitmapDrawable(view.getContext().getAssets().open(path)));

    Read the article

  • How do I create a named temporary file on windows in Python?

    - by Chris B.
    I've got a Python program that needs to create a named temporary file which will be opened and closed a couple times over the course of the program, and should be deleted when the program exits. Unfortunately, none of the options in tempfile seem to work: TemporaryFile doesn't have a visible name NamedTemporaryFile creates a file-like object. I just need a filename. I've tried closing the object it returns (after setting delete = False) but I get stream errors when I try to open the file later. SpooledTemporaryFile doesn't have a visible name mkstemp returns both the open file object and the name; it doesn't guarantee the file is deleted when the program exits mktemp returns the filename, but doesn't guarantee the file is deleted when the program exits I've tried using mktemp1 within a context manager, like so: def get_temp_file(suffix): class TempFile(object): def __init__(self): self.name = tempfile.mktemp(suffix = '.test') def __enter__(self): return self def __exit__(self, ex_type, ex_value, ex_tb): if os.path.exists(self.name): try: os.remove(self.name) except: print sys.exc_info() return TempFile() ... but that gives me a WindowsError(32, 'The process cannot access the file because it is being used by another process'). The filename is used by a process my program spawns, and even though I ensure that process finishes before I exit, it seems to have a race condition out of my control. What's the best way of dealing with this? 1 I don't need to worry about security here; this is part of a testing module, so the most someone nefarious could do is cause our unit tests to spuriously fail. The horror!

    Read the article

  • How to check and match the possible combinations of arraylist elements

    - by Jessy
    String [] A = {"High","Medium","Low"}; String [] B = {"High","Medium","Low"}; String [] C = {"High","Medium","Low"}; String [] D = {"High","Medium","Low"}; String [] E = {"High","Medium","Low"}; String [] F = {"High","Medium","Low"}; JComboBox Ai = new JComboBox(A); JComboBox Bi = new JComboBox(B); JComboBox Ci = new JComboBox(C); JComboBox Di = new JComboBox(C); JComboBox Ei = new JComboBox(E); JComboBox Fi = new JComboBox(F); .... //add the user choice in arrayList ArrayList<String> a = new ArrayList<String>(); a.add((String) Ai.getSelectedItem()); a.add((String) Bi.getSelectedItem()); a.add((String) Ci.getSelectedItem()); a.add((String) Di.getSelectedItem()); a.add((String) Ei.getSelectedItem()); a.add((String) Fi.getSelectedItem()); Scenario: On each comboBox, user need to choose one, which mean there are 6 choices at the end. There are 6*5*4*3*2*1 = 720 possible combinations of choices made by the user. What is the best way to check and match the user choice without writing the 720 else if ? e.g. if(Ai=="High" && Bi=="High" && Ci=="Low" && Di=="High" && Ei=="Low" && Fi=="Medium") { System.out.println("Good Choice"); } Thank you.

    Read the article

  • about post data

    - by Garnono
    hi,everyone.my question like this: post.php <?php $str = "testmytest"; $str_serialize = serialize($str); http_post_fields("get_post.php", array('str' => $str_serialize)); ?> get_post.php <?php if (isset($_POST['str'])) { $echo $_POST['str']; $str = unserialize($_POST['str']); echo $str; } ?> i can not unserialize the $str, it is changed.who knows why? Thanks for everybody.

    Read the article

  • RT database scaling

    - by rplevy
    Recently I heard someone suggest that RT request tracker may have scalability issues due to its non-normalized database (someone at a Perl meeting I went to referred to it in a positive light as hyper-normalized, but I think he may have misunderstood what normalization is all about). On the other hand I know that large scale enterprises such as Perl's CPAN use RT. Do es this level of scale require special measures to be taken to handle what happens when the db grows too large? What have your experiences been?

    Read the article

  • Binary management/delivery

    - by Stan
    Is there any good solution to management server application binaries (may up to 1GB), with the aim of achieving version control and delivery, and have a way to verify that every remote server has same version? Our operating system is Windows Server 2003.

    Read the article

  • Problem using Polar Irda device in Windows Server 2008

    - by AngrySpade
    I'm attempting to use the Polar IrDA device with Windows Server 2008 R2 x64. Although they dont make explicit drivers for it, I figured the Windows 7 x64 drivers would do. http://www.polar.fi/en/support/downloads?product=&category=Software&documenttitle=Polar+IrDA+USB+Adapter+drivers&document=/gip/PKBStoGIP.nsf/web_cat/C225742500419A8AC2257458003D3F40 The device has a yellow warning icon in Device Manager. Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged. (Code 19) Is there anything I can do about this?

    Read the article

  • linq2sql : get generic type of table

    - by benpage
    i think this is a simple question but I've searched around and can't seem to find an answer easily. if you have var list = List<int>(); ... fill list ... and you want to get the generic type in list, i realise you could just type: var t = list.FirstOrDefault().GetType(); Is there another way to do this via just the list, rather than referring to the enumeration? Reason is, i have a System.Data.Linq.Table<TABLE1> and what i want to do is get the type of TABLE1 from it. so: var table = new DataContext().TABLE1s; // this is Table<TABLE1> var tableType = table.GetType().SomeMethod(); // i want tableType to equal TABLE1.GetType()

    Read the article

  • Core Data - Calculated Fields

    - by Jacob
    Hi, I Know how to use core data with UITableview but how can I use the NSFetchedController to get calculated fields. Is there an example I can follow? LIke i want to go through all the NSManagedObjects and then add its "mark" field but can this be done in easier way or do I have to do it all manually. Thanks

    Read the article

  • How do I INSERT INTO from one mysql table into another table and set the value of one column?

    - by Laxmidi
    Hi, I need to insert data from table1 into table2. However, I would like to set the myYear column in table2 to 2010. But, there isn't a myYear Column in table1. So, my basic insert looks like: INSERT INTO `table2` ( place, event ) SELECT place, event FROM table1 Roughly, I'd like to do something like the following: INSERT INTO `table2` ( place, event, SET myYear='2010' ) ... Is there a way to set the column value in the insert statement? THANK YOU! -Laxmidi

    Read the article

  • How do you read a segfault kernel log message.

    - by Sullenx
    This can be a very simple question, I'm am attempting to debug an application which generates the following segfault error in the kern.log /var/log/kern.log.0:Jan 8 13:25:56 myhost kernel: myapp[15514]: segfault at 794ef0 ip 080513b sp 794ef0 error 6 in myapp[8048000+24000] Here are my questions: 1) Is there any documentation as to what are the diff error numbers on segfault, in this instance it is error 6, but i've seen error 4, 5 2) What is the meaning of the information at bf794ef0 ip 0805130b sp bf794ef0 and myapp[8048000+24000]? So far i was able to compile with symbols, and when i do a "x 0x8048000+24000" it returns a symbol, is that the correct way of doing it? My assumptions thus far are the following: sp = stack pointer? ip = instruction pointer at = ???? myapp[8048000+24000] = address of symbol?

    Read the article

  • What is a robust method for capturing screen of child window in Windows 7?

    - by Dogan Demir
    Pardon my frustration. I've asked about this in many places and I seriously don't think that there wouldn't be a way in Windows 7 SDK to accomplish this. All I want, is to capture part of a 'child window' ( setParent() ) created by a parent. I used to do this with bitblt() but the catch is that the child window can be any type of application, and in my case has OpenGL running in a section of it. If I bitblt() that, then the OGL part comes blank, doesn't get written to the BMP. DWM, particularly dwmRegisterThumbnail() doesn't allow thumbnail generation of child windows. So please give me a direction. Thanks.

    Read the article

  • How to suppress Flash migration warnings (1090)

    - by aaaidan
    I get "migration issue" warnings when I use mouse/keyboard input handler names such as onMouseDown, onKeyUp, etc. These names are perfectly legal, but sensibly, we are now warned that their use is no longer automatic in ActionScript 3. I want to suppress these warnings, but without suppressing all other warnings, which I find useful. E.g., when I use code like this: protected override function onMouseDown(e:MouseEvent):void { I get an annoying warning like this: Warning: 1090: Migration issue: The onMouseDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( 'mouseDown', callback_handler). There are flex compiler (mxmlc) flags which can suppress actionscript warnings, or all warnings, but I don't want that. That's to general. Ideally I could suppress a specific error/warning number (Warning #1090). Halp?

    Read the article

  • Visual C# GUI Designer - Recommended way of removing generated event handler-code & basic tutorial

    - by cusack
    Hi, I'm new to the Visual C# designer so these are general and pretty basic question on how to work with the designer. When we for instance add a label to a form and then double-click on it in the Visual C# designer (I'm using Microsoft Visual C# 2008 Express Edition), the following things happen: The designer generates code within Form1.Designer.cs (assume default names for simplicity) to add the label, then with the double-click it will add the event handler label1_Click to the label within Form1.Designer.cs, using the following code this.label1.Click += new System.EventHandler(this.label1_Click); and it adds the event handler method to Form1.cs private void label1_Click(object sender, EventArgs e) { } If I now remove the label only the code within Form1.Designer.cs will be removed but the label1_Click method will stay within Form1.cs even if it isn't used by anything else. But if I'm using reset within Properties-Events for the Click-event from within the designer even the label1_Click method in Form1.cs will be removed. 1.) Isn't that a little inconsistent behavior? 2.) What is the recommended way of removing such generated event handler-code? 3.) What is the best "mental approach"/best practice for using the designer? I would approach it by mental separation in the way that Form1.cs is 100% my responsibility and that on the other hand I'm not touching the code in Form1.Designer.cs at all. Does that make sense or not? Since sometimes the designer removes sth. from Form1.cs I'm not sure about this. 4.) Can you recommend a simple designer tutorial that assumes no Visual C# designer knowledge but expects/doesn't explain C#. The following one is an example of what I would not want it explains what a c#-comment is and I'd prefer text over video as well: http://msdn.microsoft.com/en-us/beginner/bb964631.aspx

    Read the article

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