UK is currently 1 hour ahead of UTC due to Daylight Savings Time. When I check the Daylight Bias value from GetTimeZoneInformation it is currently -60. Does that mean that translating UTC to DST means DST = UTC + -1 * DaylightBias, ie negate and add?
I thought in this case for instance adding Daylight Bias to UTC is the correct operation, hence requiring DaylightBias to be 60 rather than -60.
Hey guys, I was playing around with storyboards, a flipping animation, and visual brushes. I have encountered an issue though. Below is the xaml and code-behind of a small sample I quickly put together to try to demonstrate the problem.
When you first start the app, you are presented with a red square and two buttons. If you click the "Flip" button, the red square will "flip" over and a blue one will appear. In reality, all that is happening is that the scale of the width of the StackPanel that the red square is in is being decreased until it reaches zero and then the StackPanel where a blue square is, whose width is initially scaled to zero, has its width increased. If you click the "Flip" button a few times, the animation looks ok and smooth.
Now, if you hit the "Reflection" button, a reflection of the red/blue buttons is added to their respective StackPanels. Hitting the "Flip" button now will still cause the flip animation but it is no longer a smooth animation. The StackPanels width often does not shrink to zero. The width shrinks somewhat but then just stops before being completely invisible. Then the other StackPanel appears as usual. The only thing that changed was adding the reflection, which is just a VisualBrush.
Below is the code. Does anyone have any idea why the animations are different between the two cases (stalling in the second case)?
Thanks.
Here are the button click handlers:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Media.Animation;
namespace WpfFlipTest { public partial class Window1 : Window { public Window1() { InitializeComponent(); }
I have been testing this some more to try to find out what is causing the issue I am seeing and I believe I found what is causing the issue.
Below I have pasted new xaml and code-behind. The new sample below is very similar to the original sample, with a few minor modifications. The xaml basically consists of two stack panels, each containing two borders. The second border in each stack panel is a visual brush (a reflection of the border above it). Now, when I click the "Flip" button, one stack panel gets its ScaleX reduced to zero, while the second stack panel, whose initial ScaleX is zero, gets its ScaleX increased to 1. This animation gives the illusion of flipping. There are also two textblocks which display the scale factor of each stack panel. I added those to try to diagnose my issue.
The issue is (as described in the oringal post) that the flipping animation is not smooth. Every time I hit the flip button, the animation starts but whenever the ScaleX factor gets to around .14 to .16, the animation looks like it stalls and the stack panels never have there ScaleX reduced to zero, so they never totally disappear. Now, the strange thing is that if I change the Width/Height properties of the "frontBorder" and "backBorder" borders defined below to use explict values instead of Auto, such as Width=105 and Height=75 (to match the button in the border) everything works fine. The animation stutters the first two or three times I run it but after that the flips are smooth and flawless. (BTW, when an animation is run for the first time, is there something going on in the background, some sort of initialization, that causes it to be a little slow the first time?)
Is it possible that the Auto Width/Height of the borders are causing the issue? I can reproduce it everytime but I am not sure why Auto Width/Height would be a problem.
Below is the sample. Thanks for the help.
Code-behind:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Media.Animation;
namespace FlipTest { /// /// Interaction logic for Window1.xaml /// public partial class Window1 : Window { public Window1() { InitializeComponent(); }
2) is doctype HTML 5 in use? or is it better to use one of these: - HTML 4.01 Strict, - HTML 4.01 Transitional, - HTML 4.01 Frameset, - XHTML 1.0 Strict, - XHTML 1.0 Transitional, - XHTML 1.0 Frameset, - XHTML 1.1
I've just taken on a new Asp.Net MVC application and after opening it up I find the following,
[Project].Web
[Project].Models
[Project].BLL
[Project].DAL
Now, something thats become clear is that there is the data has to do a hell of a lot before it makes it to the View (Database>DAL>Repo>BLL>ConvertToModel>Controller>View). The DAL is Subsonic, the repositorys in the DAL return the subsonic entities to the BLL which process them does crazy things and converts them into a Model (From the .Models) sometimes with classes that look like this
public DataModel GetDataModel(EntityObject Src) { var ReturnData = new DataModel(): ReturnData.ID = Src.ID; ReturnDate.Name = Src.Name;
//etc etc }
Now, the question is, "Is this complete overkill"? Ok the project is of a decent size and can only get bigger but is it worth carrying on with all this? I dont want to use AutoMapper as it just seems like it makes the complication worse. Can anyone shed any light on this?
// Major edit, sorry in bed with back pain, screwed up post
One of the ad agencies I code for had me set up an alternate scrolling solution because you know how designers hate things that just work but aren't beautiful.
The scrolling solution is applied to divs with overflow:hidden and uses jQuery's scrollTo(). It's a set of buttons top and bottom that handle moving the content.
So, this is married in places to their CMS. What I have not been able to sort yet is how to hide the scrolling UI when overflow:auto would not have been triggered by the CMS content and the buttons are not needed.
The divs have set heights and widths. Can i detect hidden content? Or measure the div contents' height?
I am trying to call the browse() method of the FileReference class from JavaScript (a user clicks on a text that uses the ExternalInterface to call a method in Flash).
Unfortunately, I receive an error that tells me it has to be a direct action of the user (like clicking a button). I have searched through Google and realized this is a new security feature in Flash 10.
The only solutions I could find was to put a Flash button or to have a hidden flash button over the text, that will call the browse() method.
I wanted the browser only to show JavaScript and all the Flash code only called from JavaScript.
I have an application that is unresponsive and seems to be in a deadlock or something like a deadlock. See the two threads below. Notice that the My-Thread@101c thread blocks AWT-EventQueue-0@301. However, My-Thread has just called java.awt.EventQueue.invokeAndWait(). So AWT-EventQueue-0 blocks My-Thread (I believe).
My-Thread@101c, priority=5, in group 'main', status: 'WAIT' blocks AWT-EventQueue-0@301 at java.lang.Object.wait(Object.java:-1) at java.lang.Object.wait(Object.java:485) at java.awt.EventQueue.invokeAndWait(Unknown Source:-1) at javax.swing.SwingUtilities.invokeAndWait(Unknown Source:-1) at com.acme.ui.ViewBuilder.renderOnEDT(ViewBuilder.java:157) . . . at com.acme.util.Job.run(Job.java:425) at java.lang.Thread.run(Unknown Source:-1)
AWT-EventQueue-0@301, priority=6, in group 'main', status: 'MONITOR' waiting for My-Thread@101c at com.acme.persistence.TransactionalSystemImpl.executeImpl(TransactionalSystemImpl.java:134) . . . at com.acme.ui.components.MyTextAreaComponent$MyDocumentListener.insertUpdate(MyTextAreaComponent.java:916) at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source:-1) at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source:-1) at javax.swing.text.AbstractDocument$DefaultFilterBypass.replace(Unknown Source:-1) at javax.swing.text.DocumentFilter.replace(Unknown Source:-1) at com.acme.ui.components.FilteredDocument$InputDocumentFilter.replace(FilteredDocument.java:204) at javax.swing.text.AbstractDocument.replace(Unknown Source:-1) at javax.swing.text.JTextComponent.replaceSelection(Unknown Source:-1) at javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(Unknown Source:-1) at javax.swing.SwingUtilities.notifyAction(Unknown Source:-1) at javax.swing.JComponent.processKeyBinding(Unknown Source:-1) at javax.swing.JComponent.processKeyBindings(Unknown Source:-1) at javax.swing.JComponent.processKeyEvent(Unknown Source:-1) at java.awt.Component.processEvent(Unknown Source:-1) at java.awt.Container.processEvent(Unknown Source:-1) at java.awt.Component.dispatchEventImpl(Unknown Source:-1) at java.awt.Container.dispatchEventImpl(Unknown Source:-1) at java.awt.Component.dispatchEvent(Unknown Source:-1) at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source:-1) at java.awt.Component.dispatchEventImpl(Unknown Source:-1) at java.awt.Container.dispatchEventImpl(Unknown Source:-1) at java.awt.Window.dispatchEventImpl(Unknown Source:-1) at java.awt.Component.dispatchEvent(Unknown Source:-1) at java.awt.EventQueue.dispatchEvent(Unknown Source:-1) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEvents(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEvents(Unknown Source:-1) at java.awt.EventDispatchThread.run(Unknown Source:-1)
Here is the TransactionalSystemImpl.executeImpl method:
I have written a program in C to send a byte to serial port (com). I have used BIOSCOM to send data but I guess that it doesn't open the port. Please tell how I can open and close a com port in C.
I have an application that is unresponsive and seems to be in a deadlock or something like a deadlock. See the two threads below. Notice that the My-Thread@101c thread blocks AWT-EventQueue-0@301. However, My-Thread has just called java.awt.EventQueue.invokeAndWait(). So AWT-EventQueue-0 blocks My-Thread (I believe).
My-Thread@101c, priority=5, in group 'main', status: 'WAIT' blocks AWT-EventQueue-0@301 at java.lang.Object.wait(Object.java:-1) at java.lang.Object.wait(Object.java:485) at java.awt.EventQueue.invokeAndWait(Unknown Source:-1) at javax.swing.SwingUtilities.invokeAndWait(Unknown Source:-1) at com.acme.ui.ViewBuilder.renderOnEDT(ViewBuilder.java:157) . . . at com.acme.util.Job.run(Job.java:425) at java.lang.Thread.run(Unknown Source:-1)
AWT-EventQueue-0@301, priority=6, in group 'main', status: 'MONITOR' waiting for My-Thread@101c at com.acme.persistence.TransactionalSystemImpl.executeImpl(TransactionalSystemImpl.java:134) . . . at com.acme.ui.components.MyTextAreaComponent$MyDocumentListener.insertUpdate(MyTextAreaComponent.java:916) at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source:-1) at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source:-1) at javax.swing.text.AbstractDocument$DefaultFilterBypass.replace(Unknown Source:-1) at javax.swing.text.DocumentFilter.replace(Unknown Source:-1) at com.acme.ui.components.FilteredDocument$InputDocumentFilter.replace(FilteredDocument.java:204) at javax.swing.text.AbstractDocument.replace(Unknown Source:-1) at javax.swing.text.JTextComponent.replaceSelection(Unknown Source:-1) at javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(Unknown Source:-1) at javax.swing.SwingUtilities.notifyAction(Unknown Source:-1) at javax.swing.JComponent.processKeyBinding(Unknown Source:-1) at javax.swing.JComponent.processKeyBindings(Unknown Source:-1) at javax.swing.JComponent.processKeyEvent(Unknown Source:-1) at java.awt.Component.processEvent(Unknown Source:-1) at java.awt.Container.processEvent(Unknown Source:-1) at java.awt.Component.dispatchEventImpl(Unknown Source:-1) at java.awt.Container.dispatchEventImpl(Unknown Source:-1) at java.awt.Component.dispatchEvent(Unknown Source:-1) at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source:-1) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source:-1) at java.awt.Component.dispatchEventImpl(Unknown Source:-1) at java.awt.Container.dispatchEventImpl(Unknown Source:-1) at java.awt.Window.dispatchEventImpl(Unknown Source:-1) at java.awt.Component.dispatchEvent(Unknown Source:-1) at java.awt.EventQueue.dispatchEvent(Unknown Source:-1) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEvents(Unknown Source:-1) at java.awt.EventDispatchThread.pumpEvents(Unknown Source:-1) at java.awt.EventDispatchThread.run(Unknown Source:-1)
Here is the TransactionalSystemImpl.executeImpl method:
We have three web servers in our web farm that are load balanced using the Network Load Balancing Manager in Windows 2003. The sites that run on these boxes use In-Proc ASP.NET session. Our assumption is that the balancing uses a "sticky" session because users seem to be assigned to a given server during their use of the application as well as there doesn't appear to be any session error where the session data is residing on a previous machine. My question is how can I 1) verify that our balancing configuration is using "sticky" sessions and 2) can someone explain the load balancing feature in Windows 2003 relative to ASP.NET web applications?
I'm trying to make a small silverlight application but i became across a problem, playing videos from youtube. I tried a method with a html conteiner to embed the youtube flash player, but with this method i need to activate the option windowsless, and thats is not a good ideia for my web site. If anyone have a good ideia,I'm glad to hear
I'm trying to add random numbers onto the end of this array when ever I call this function. I've narrowed it down to just this so far. when ever I check to see if anything is in the array it says 0. So now i'm quite stumped. I'm thinking that MutableArray releases the contents of it before I ever get to use them. problem is I don't know what to use. A button calls the function and pretty much everything else is taken care of its just this portion inside the function.
NSMutableArray * choices;
-(void) doSomething {
int r = arc4random() % 4; //The problem... [choices addObject:[NSNumber numberWithInt:r]];
int anInt = [[choices objectAtIndex:1] integerValue]; NSLog(@"%d", anInt); //I'm getting nothing no matter what I do.
//some type of loop that goes through the array and displays each element //after it gets added
I have a TreeView with check boxes, and when a user checks a child node, I want to go up the tree and check each parent. However, for some reason my application blows up whenever I touch the parent node. For the nodes in my tree, I've extended TreeNode to create my own objects with some data that I need to store in them, but I still reference them as TreeNodes when checking/unchecking. My code looks like this:
From this article on CodeGuru about PayPal IPN, I see there are two fields, payer_email and payer_id, that can be used to identify the user. Is there anything else I'm missing? Do you use these fields to identify the user or how do you do it?
This is slightly embarrassing. I'm a professional developer working at one of the big tech companies and I've never used a database. I've got an idea for a website I want to build as a learning experience and possibly as a business, but I don't have the faintest idea what database to use, let alone how to fix/debug the database when I run into problems.
I'm looking for a course, a website, a book, etc., that will give me an overview of modern database technology (SQL vs. NOSQL vs. relational vs. non-relational (I only have a vague idea what these even mean)). I'm starting by googling/wikipediaing all of these terms, but if there are better, comprehensive resources available that I should be aware of, I'd love to hear about them.
I have a report where I need to filter out records where there is a duplicate contract number within the same station but a different date. It is not considered a duplicate value becuase of the different date. I then need to summarize the costs and count the contracts but even if i suppress the "duplicate fields" it will summarize the value. I want to select the record with the most current date.
int init_module() { /* create the /proc file */ Our_Proc_File = create_proc_entry(PROC_ENTRY_FILENAME, 0644, NULL); /* check if the /proc file was created successfuly */ if (Our_Proc_File == NULL){ printk(KERN_ALERT "Error: Could not initialize /proc/%s\n", PROC_ENTRY_FILENAME); return -ENOMEM; }
We want to add a comments/reviews feature to our website's plugin gallery, so users can vote up/down a particular plugin and leave an optional short comment about what they liked or didn't like about it.
I'm looking for inspiration, ideally a good implementation elsewhere on the web which isn't annoying to end users, isn't impossibly complex to develop, and which enables users to see both good and bad comments side-by-side, like this:
Like: 57 votes Dislike: 8 votes --------------------------------- -------------------------------- "great plugin, saved me hours..." "hard to install"
"works well on MacOS and Ubuntu" "Broken on Windows Vista with UAC enabled" "integrates well with version 3.2" More... More...
Anyone know a site which does something like this particularly well? I don't need source code (since implementation will be simple), just looking for UI inspiration and best practices.
I'll accept the answer which refers me to the site which, in my biased opinion, is the best mix of usable (for end users reading comments) and addictive (for active users leaving comments).
What I'd like is to split a string containing a CSS property value into an array of [string,value,unit].
For example: if I supplied the .split() method with 1px it'd return ["1px",1,"px"]. If I were to supply, similarly, 10% it'd return ["10%",10,"%"].
Can this be done?
I appreciate all your help!
Update: I'd also like it to return ["1.5em",1.5,"em"] if 1.5em were supplied. But, if possible, still return null if supplied "yellow". Unfortunately /^([0-9].?[0-9])(.*)/ supplied with "yellow" would return y,,y!
"Programming Pearls" in the column 2 ("AHA! Algorithm") talks about how binary search aids in various processes like sorting, tree traversals. But it mentions that binary seach can be used in "program debugging". Can somebody please explain how this is done?
I have a farm of web servers, and a web site who configures the IIS website using the class ServerManager. When I call the OpenRemote method on the ServerManager class I always get an error of type :
Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine 10.10.10.101 failed due to the following error: 80070005.
Did someone allready had this problem and know how to solve it ?
I try to give the domain admin role to my IIS user (impersonate) but even that did not work
My bho (Browser Helper Object) is a sidebar (right-sided iframe) that needs to be opened/closed by clicking the status bar icon in IE (IE8). I didn't find any informations for clickable icons. Anyone knows wich interface to use to do that. Thank you. (I'm using ATL: Active Template Library). If anyone need precision, please ask. I'll be waiting for responses every single days.
I have a series of Ajax calls being made that load() other HTML fragments which in turn load() other fragments. The whole thing is confusing. I didn't write the code.
Is there any tool which will allow me to walk the callstack so I can figure what is calling a method? any browser tools that would help me figure this out?
Here is the situation, I have a login page as the initial rootView of a tab bar. Once the login process is done, the view is removed from the navigation controller, so you don't navigate back to it. I have places in the app where you can logout. The logout process works fine, but when I try to forward the user back to the initial login view (the one we removed) from inside the same tab bar item, I can't seem to reset the view controller stack to contain only the desired element. Is this a question of where I am changing the view? It just doesn't seem to remove the current view. I have tried alot of stuff, popto, popview, and many others, and nothing seems to work properly. Has anyone had to deal with this?
I have a fairly large MS-Sql database; I'd like to pull 4 tables out and dump them directly into an sqlite.db for remote querying (via nightly batch).
I was about to write a script to step through(most likely on a unix host kicked off via cron); but there should be a simpler method to export the tables directly (SQLite not an option in the included DTS Import/Export wizard)
What would the most efficient method of dumping the MS Sql tables to SQLite via batch be?
Write a recursive method that converts a decimal number into a binary number as a string. The method header is as follows: public static String convertDecimalToBinary(int value)
This is what I have so far:
public static String convertDecimalToBinary(int value) { if (value == 0) return
Is there a way in Powershell to query the object Property Page Details to verify if the Copyright, Product name and File version are not empty. I want to be able to query this info when I'm looking for viruses
I�ve recently installed git and initialized a git repo in my project folder. I can commit and checkout without any issues through the command line, but for some reason the gui in qt creator claims my connection has timed out. Im running windows�. Any ideas?
Error message(s):
21:15 Executing: git status �u Unable to obtain the status: Error: Git timed out
Please let me know if any further clarification is needed!
I've posted this on both qt forums, but no one seems to know how to solve the issue. Thanks in advance!
Hey guys, I've got what I imagine is a simple question, but for some reason, I can't get it working right.
Expected Behavior: I type characters into a field, and, through a function, those characters are translated into the value of the name HTML attribute.
Actual Behavior: Reflected in Firebug, the value doesn't change or update.
The Code:
$('input').live('keyup', function() { var name_value = $(this).val().toLowerCase(); $(el).attr('name', name_value); });
Just a side note: I'm using .live() because the element can be cloned, and those clones need to also be able to take on the properties of this .keyup event.
I'm having a hell of a time finding documentation which clearly explains how to use a static library in QT Creator.
I've created and compiled my static library using QT Creator (New=>Projects\C++ Library=>Set type to "Statically Linked Library"). It compiles and spits out a ".a file".
The problem I encounter is when I try to use the library. I have another project that would like to use it (#include files in the library, etc) but I don't know the proper way to link with the library or include files from the library.
I have an attribute lets call it SomeAttribute and a class i need to make sure the class is passed a type which has SomeAttribute. So this is how i do it now:
public class Test() { public Test(SomeType obj) { if(!obj.GetType().IsDefined(typeof(SomeAttribute), false)) { throw new ArgumentException("Errormessage"); } } }
But this means that i don't get any errors at compile time but somewhere at runtime, if obj does not have the attribute. Is there a way to specify in the method declaration that the parameter must have some attribute ? So i get errors i compile time when using the wrong parameters, or do i have to use an empty interface ?
EDIT: I think the easiest solution would be an empty interface.
I would like to profile my c++ application on linux. I would like to find out how much time my application spent on CPU processing vs time spent on block by IO/being idle.
I know there is a profile tool call valgrind on linux. But it breaks down time spent on each method, and it does not give me an overall picture of how much time spent on CPU processing vs idle? Or is there a way to do that with valgrind.
Having a ModelFormSet built with modelformset_factory and using a model with an optional ForeignKey, how can I make empty (null) associations to validate on that form?
Here is a sample code:
### model class Prueba(models.Model): cliente = models.ForeignKey(Cliente, null = True) valor = models.CharField(max_length = 20)
### view
def test(request): PruebaFormSet = modelformset_factory(model = Prueba, extra = 1) if request.method == 'GET': formset = PruebaFormSet() return render_to_response('tpls/test.html', {'formset' : formset}, context_instance = RequestContext(request)) else: formset = PruebaFormSet(request.POST) # dumb tests, just to know if validating if formset.is_valid(): return HttpResponse('0') else: return HttpResponse('1')
In my template, i'm just calling the {{ form.cliente }} method which renders the combo field, however, I want to be able to choose an empty (labeled "------") value, as the FK is optional... but when the form gets submitted it doesn't validate.
Is this normal behaviour? How can i make this field to skip required validation?
I'm new to Python 3 and so far it seems like a decent language. I really like the string manipulation methods you can use and they are pretty radical. :)
I'm stuck however in thinking of a project to do with Python. Is there a site similar to Coding4Fun but for Python?
Community Wiki because I think this question is really interesting. :D
move is a byte, move is still a byte, and the rest is being cast to a byte.
I get this error:
[javac] /Users/looris/Sviluppo/dumdedum/client/src/net/looris/android/toutry/Guy.java:245: possible loss of precision [javac] found : int [javac] required: byte [javac] this.move=(this.move<<4)|(byte)(Guy.moven.indexOf("left")&0xF); [javac] ^
I've tried many variations but I still get the same error.
Hi, this is a CSS / design question. I have three textboxes that i want to be center aligned on a web page. Then i want a label description to the right of each one.
When i use attribute like text:align:centre because the labels are of different length it throws out the aligment of the textboxes [see image link below]
On Google App Engine in Python, I have a Visit entity that has a parent of Patient. A Patient may have multiple visits.
I need to set the most_recent_visit (and some auxiliary visit data) somewhere for later querying, probably in another child entity that Brett Slatkin might call a "relationship index entity."
I wish to do so in a bulk style as follows:
1. get 100 Patient keys 2. get all Visits that have any of the Patients from 1 as an ancestor 3. go through the Visits and get the latest for each Patient
Is there any way to perform step 2 in a bulk get?
I know there is a way to bulk get entities from a list of keys, and there is a way to match a single entity by its ancestor.
MVC UI |...CustomerController (ICustomerRepository - how do I instantiate this?)
Data Model |...ICustomerRepository
DAL (Separate Data access layer, references Data Model to get the IxRepositories) |...CustomerRepository (inherits ICustomerRepository)
What's the correct way to say ICustomerRepository repository = new CustomerRepository(); when the Controller has no visibility to the DAL project? Or am I doing this completely wrong?
I have an application in PHP (private CMS) that I would like to rewrite and add some new things - I would like to be able to extend my app in an easier way - through plugins
But the problem is - I don't know how to achieve "pluggability", how to make system that recognizes plugins and injects them into the app?
What are some tools (commercial or OSS) that provide a GUI-based mechanism for creating schema upgrade scripts? To be clear, here are the tool responsibilities:
Obtain connection to recent schema version (called "source").
Obtain connection to previous schema version (called "target").
Compare all schema objects between source and target.
Create a script to make the target schema equivalent to the source schema ("upgrade script").
Create a rollback script to revert the source schema, used if the upgrade script fails (at any point).
Create individual files for schema objects.
The software must:
Use ALTER TABLE instead of DROP and CREATE for renamed columns.
Work with Oracle 10g or greater.
Create scripts that can be batch executed (via command-line).
Trivial installation process.
(Bonus) Create scripts that can be executed with SQL*Plus.
Here are some examples (from StackOverflow, ServerFault, and Google searches):
LiquiBase - Requires changing the development process. No installer. Manually edit config files. Does not recognize its own baseUrl parameter.
The only acceptable crippling of the evaluation version is by time. Crippling by restricting the number of tables and views hides possible bugs that are only visible in the software during the attempt to migrate hundreds of tables and views.
I have a model called HeroStatus with the following attributes:
id
user_id
recordable_type
hero_type (can be NULL!)
recordable_id
created_at
There are over 100 hero_statuses, and a user can have many hero_statuses, but can't have the same hero_status more than once.
A user's hero_status is uniquely identified by the combination of recordable_type + hero_type + recordable_id. What I'm trying to say essentially is that there can't be a duplicate hero_status for a specific user.
Unfortunately, I didn't have a validation in place to assure this, so I got some duplicate hero_statuses for users after I made some code changes. For example:
(Last two are not a dups obviously. First two are.) So what I want to do is get rid of the duplicate hero_status. Which one? The one with the most-recent date.
I have three questions:
How do I remove the duplicates using a SQL-only approach?
I decided to use the singleton design pattern while creating a view helper class. This got me thinking; will the singleton instance survive across requests? This led to another question, Which variables (if any) survive across web requests and does that change depending on deployment? (Fastcgi, Mongrel, Passenger, ...)
I know that Controller instance variables aren't persisted. I know Constants are persisted (or reloaded?). But I don't know about class variables, instance variables on a class, Eigenclasses, ...
I need to generate quickly lots of random numbers from binomial distributions for dramatically different trial sizes (most, however, will be small). I was hoping not to have to code an algorithm by hand (see, e.g., this related discussion from November), because I'm a novice programmer and don't like reinventing wheels. It appears Boost does not supply a generator for binomially distributed variates, but TR1 and GSL do. Is there a good reason to choose one over the other, or is it better that I write something customized to my situation? I don't know if this makes sense, but I'll alternate between generating numbers from uniform distributions and binomial distributions throughout the program, and I'd like for them to share the same seed and to minimize overhead. I'd love some advice or examples for what I should be considering.
I have a Django Model with updated_by and an approved_by fields, both are ForeignKey fields to the built-in (auth) User models.
I am aware that with updated_by, it's easy enough to simply over-ride the .save() method on the Model, and shove the request.user in that field before saving.
However, for approved_by, this field should only ever be filled in when a related field (date_approved) is first filled in. I'm somewhat certain that I can check this logically, and fill in the field if the previous value was empty.
What is the proper way to check the previous value of a field before saving an object?
I do not anticipate that date_approved will ever be changed or updated, nor should there be any reason to ever update the approved_by entry.
UPDATE:
Regarding forms/validation, I should have mentioned that none of the fields in question are seen by or editable by users of the site. If I have misunderstood, I'm sorry, but I'm not sure how forms and validation apply to my question.
I have a table in SQL Server which looks like this:
ID Code Name Surname 1 MS Mike Smith 2 JD John Doe 3 UP Unknown Person
and so on...
Now I want to bind the data from this table into the ComboBox in a way that in the ComboBox I have displayed value from the Code column.
I am doing the binding in this way:
SqlDataAdapter sqlAdapter = new SqlDataAdapter("SELECT * FROM dbo.Users ORDER BY Code", MainConnection); sqlAdapter.Fill(dsUsers, "Users"); cbxUsers.DataSource = dsUsers.Tables["Users"]; cmUsers = (CurrencyManager)cbxUsers.BindingContext[dsUsers.Tables["Users"]]; cbxUsers.DisplayMember = "Code";
And this code seems to work. I can scroll through the list of Codes. Also I can start to write code by hand and ComboBox will autocomplete the code for me.
However, I wanted to put a label at the top of the combobox to display Name and Surname of the currently selected user code.
My line of though was like that: "So, I need to find an event which will fire up after the change of code in combobox and in that event I will get the current DataRow..."
I was browsing through the events of combobox, tried many of them but without a success.
This give me a strange results. Firstly when I scroll via mouse scroll it doesn't return me the row wich I am expecting to obtain. For example on JD it shows me "Mike Smith", on MS it shows me "John Doe" and on UP it shows me "Mike Smith" again! The other problem is that when I start to type in ComboBox and press enter it doesn't trigger the event.
However, everything works as expected when I bind data to lblNameSurname.Text in this way:
The problem here is that I can bind only one column and I want to have two. I don't want to use two labels for it (one to display name and other to display surname).
So, what is the solution to my problem?
Also, I have one question related to the data selection in ComboBox. Now, when I type something in the combobox it allows me to type letters that are not existing in the list. For example, I start to type "J" and instead of finishing with "D" so I would have "JD", I type "Jsomerandomtexthere". Combobox will allow that but such item does not exists on the list. In other words, I want combobox to prevent user from typing code which is not on the list of codes.
I'm experiencing an intermittent problem with a class that extends javax.swing.text.DefaultStyledDocument. This document is being sent to a printer. Most of the time the formatting of the document looks correct, but once in a while it doesn't. It looks like some of the changes in the formatting have not been applied.
I took a look at the DefaultStyledDocument.styleChanged(Style style) code:
/** * Called when any of this document's styles have changed. * Subclasses may wish to be intelligent about what gets damaged. * * @param style The Style that has changed. */ protected void styleChanged(Style style) { // Only propagate change updated if have content if (getLength() != 0) { // lazily create a ChangeUpdateRunnable if (updateRunnable == null) { updateRunnable = new ChangeUpdateRunnable(); }
// We may get a whole batch of these at once, so only // queue the runnable if it is not already pending synchronized(updateRunnable) { if (!updateRunnable.isPending) { SwingUtilities.invokeLater(updateRunnable); updateRunnable.isPending = true; } } } }
/** * When run this creates a change event for the complete document * and fires it. */ class ChangeUpdateRunnable implements Runnable { boolean isPending = false;
public void run() { synchronized(this) { isPending = false; }
Does the fact that SwingUtilities.invokeLater(updateRunnable) is called, rather than invokeAndWait(updateRunnable), mean that I can't count on my formatting changes appearing in the document before it is rendered?
If that is the case, is there a way to ensure that I don't proceed with rendering until the updates have occurred?
I apologize for such a question that likely has a trivial solution, but I strangely could not find a concise API for this problem.
Essentially, I would like to truncate a string such that it its length is not longer than a given value. I am writing to a database table and want to ensure that the values I write meet the constraint of the column's datatype.
For instance, it would be nice if I could write the following:
string NormalizeLength(string value, int maxLength) { return value.Substring(0, maxLength); }
Unfortunately, this raises an exception because maxLength exceeds the string boundaries. Of course, I could write a function like the following, but I was hoping that something like this already exists.
string NormalizeLength(string value, int maxLength) { return value.Length <= maxLength ? value : value.Substring(0, maxLength); }
Where is the elusive API that performs this task? Is there one?
I'm planning on developing an Apple Mac application which will collect hardware information from the host Mac and also installed software info. The hardware and software info will be collected in an encrypted XML file and then posted back to a website. The application should run as a "service" or background process on the Mac and can be configured to collect the data on a frequent basis defined by another encrypted XML config file.
I've done plenty of Windows based software development but never on the Mac. Can anybody point me in the direction of any useful info on how to develop on the Mac, collect hardware and software info, export to an XML file, file encryption and packaging a compiled app to run as a service? Is either Objective C, Cocoa or Ruby a possible option?
We've been discussing design of a data warehouse strategy within our group for meeting testing, reproducibility, and data syncing requirements. One of the suggested ideas is to adapt a NoSQL approach using an existing tool rather than try to re-implement a whole lot of the same on a file system. I don't know if a NoSQL approach is even the best approach to what we're trying to accomplish but perhaps if I describe what we need/want you all can help.
Most of our files are large, 50+ Gig in size, held in a proprietary, third-party format. We need to be able to access each file by a name/date/source/time/artifact combination. Essentially a key-value pair style look-up.
When we query for a file, we don't want to have to load all of it into memory. They're really too large and would swamp our server. We want to be able to somehow get a reference to the file and then use a proprietary, third-party API to ingest portions of it.
We want to easily add, remove, and export files from storage.
We'd like to set up automatic file replication between two servers (we can write a script for this.) That is, sync the contents of one server with another. We don't need a distributed system where it only appears as if we have one server. We'd like complete replication.
We also have other smaller files that have a tree type relationship with the Big files. One file's content will point to the next and so on, and so on. It's not a "spoked wheel," it's a full blown tree.
We'd prefer a Python, C or C++ API to work with a system like this but most of us are experienced with a variety of languages. We don't mind as long as it works, gets the job done, and saves us time. What you think? Is there something out there like this?
I'm deploying an app to an unknown number of clients. It'll be 5-10 to start, couple dozen eventually. I'm thinking of making a different web folder for each client, so I can control updates and roll them out in a gradual manner.
Are there any major known issues with One-Click deployment? Am I going to commit suicide shortly after golive?
When user scrolls to the bottom of the page I want to show some div, with jQuery of course. And if user scrolls back to he top, div fade out. So how to calculate viewport (or whatever is the right name) :)
Ok, I read a while back that Quantum Computers can break most types of hashing and encryption in use today in a very short amount of time(I believe it was mere minutes). How is it possible? I've tried reading articles about it but I get lost at the a quantum bit can be 1, 0, or something else. Can someone explain how this relates to cracking such algorithms in plain English without all the fancy maths?
In every design tool or art principle I've heard of, relationships are a central theme. By relationships I mean the thing you can do in Adobe Illustrator to specify that the height of one shape is equal to half the height of another. You cannot express this information in CSS. CSS hard-codes all values. Using a language like LESS that allows variables and arithmetic you can get closer to relationships but it's still a CSS variant.
This inability in my mind is the biggest problem with CSS. CSS is supposed to be a language that describes the visual component of a Web page but it ignores relationships and contraints, ideas that are at the core of art.
How possible is it to imagine a new Web design language that can express relationships and contraints that can be implemented in JavaScript using the current CSS properties?
Say I have class A and class B. B inherits from class A, and implements a few virtual functions. The only problem is that B is defined in a .dll. Right now, I have a function that returns an instance of class A, but it retrieves that from a static function in the .dll that returns an instance of class B. My plan is to call the created object, and hopefully, have the functions in the .dll executed instead of the functions defined in class A. For some reason, I keep getting restricted memory access errors. Is there something I don't understand that will keep this plan from working?