Daily Archives

Articles indexed Monday May 31 2010

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

  • Need to set cursor position to the end of a contentEditable div, issue with selection and range obje

    - by DavidR
    I'm forgetting about cross-browser compatibility for the moment, I just want this to work. What I'm doing is trying to modify a script (and you probably don't need to know this) located at typegreek.com The basic script is found here. Basically what it does is when you type in characters, it converts the character your are typing into greek characters and prints it onto the screen. What I'm trying to do is to get it to work on contentEditable div's (It only works for Textareas) My issue is with this one function: The user types a key, it get's converted to a greek key, and goes to a function, it gets sorted through some if's, and where it ends up is where I can add div support. Here is what I have so far, myField is the div, myValue is the greek character. //Get selection object... var userSelection if (window.getSelection) {userSelection = window.getSelection();} else if (document.selection) {userSelection = document.selection.createRange();} //Now get the cursor position information... var startPos = userSelection.anchorOffset; var endPos = userSelection.focusOffset; var cursorPos = endPos; //Needed later when reinserting the cursor... var rangeObj = userSelection.getRangeAt(0) var container = rangeObj.startContainer //Now take the content from pos 0 -> cursor, add in myValue, then insert everything after myValue to the end of the line. myField.textContent = myField.textContent.substring(0, startPos) + myValue + myField.textContent.substring(endPos, myField.textContent.length); //Now the issue is, this updates the string, and returns the cursor to the beginning of the div. //so that at the next keypress, the character is inserted into the beginning of the div. //So we need to reinsert the cursor where it was. //Re-evaluate the cursor position, taking into account the added character. var cursorPos = endPos + myValue.length; //Set the caracter position. rangeObj.setStart(container,cursorPos) Now, this works only as long as I don't type more than the size of the original text. Say I had 30 characters in the div before hand. If I type more than that 30, it adds character 31, but places the cursor back at 30. I can type character 32 at pos.31, then character 33 at pos.32, but if I try to put character 34 in, it adds the character, and sets the cursor back at 32. The issue is that the function for adding the new character screws up if cursorPos is greater than what is defined in the range. Any ideas?

    Read the article

  • How can I organize many results in a selectbox?

    - by zeckdude
    I have a select box that is part of a form. It is currently querying the addresses table and displaying the addresses into the select box. I plan on having up to 100 addresses. I'm looking for a solution where I can show all the states if the user clicks on the select box. Then if the user hovers over a state it will show all the addresses for that specific state. Then if the user clicks on an address, it will show that as the picked option in the select box. This is like a dropdown menu within a select box. Does anyone know where I can find a solution as this?

    Read the article

  • How should images be stored when multiple sizes are needed?

    - by Josh Curren
    What is the best way to store images? Currently when an image is uploaded I resize it to 3 different sizes (a thumbnail, a normal size, and a large size). I save in a database a description of the image, the format, and use the id number from the database as the image name. Each size image has its own directory. Should I be storing the images in the database? Should I only be storing the larger size and generate the thumbnail as needed? Or any other ideas you have?

    Read the article

  • Javascript Reference Outer Object From Inner Object

    - by Akidi
    Okay, I see a few references given for Java, but not javascript ( which hopefully you know is completely different ). So here's the code specific : function Sandbox() { var args = Array.prototype.slice.call(arguments) , callback = args.pop() , modules = (args[0] && typeof args[0] === 'string' ? args : args[0]) , i; if (!(this instanceof Sandbox)) { return new Sandbox(modules, callback); } if (!modules || modules[0] === '*') { modules = []; for (i in Sandbox.modules) { if (Sandbox.modules.hasOwnProperty(i)) { modules.push(i); } } } for (i = 0; i < modules.length; i++) { Sandbox.modules[modules[i]](this); } this.core = { 'exp': { 'classParser': function (name) { return (new RegExp("(^| )" + name + "( |$)")); }, 'getParser': /^(#|\.)?([\w\-]+)$/ }, 'typeOf': typeOf, 'hasOwnProperty': function (obj, prop) { return obj.hasOwnProperty(prop); }, 'forEach': function (arr, fn, scope) { scope = scope || config.win; for (var i = 0, j = arr.length; i < j; i++) { fn.call(scope, arr[i], i, arr); } } }; this.config = { 'win' : win, 'doc' : doc }; callback(this); } How do I access this.config.win from within this.core.forEach? Or is this not possible?

    Read the article

  • Setting custom WCF-binding behaviour via .config file - why doesn't this work?

    - by Andrew Shepherd
    I am attempting to insert a custom behavior into my service client, following the example here. I appear to be following all of the steps, but I am getting a ConfigurationErrorsException. Is there anyone more experienced than me who can spot what I'm doing wrong? Here is the entire app.config file. <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="ClientLoggingEndpointBehaviour"> <myLoggerExtension /> </behavior> </endpointBehaviors> </behaviors> <extensions> <behaviorExtensions> <add name="myLoggerExtension" type="ChatClient.ClientLoggingEndpointBehaviourExtension, ChatClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"/> </behaviorExtensions> </extensions> <bindings> </bindings> <client> <endpoint behaviorConfiguration="ClientLoggingEndpointBehaviour" name="ChatRoomClientEndpoint" address="http://localhost:8016/ChatRoom" binding="wsDualHttpBinding" contract="ChatRoomLib.IChatRoom" /> </client> </system.serviceModel> </configuration> Here is the exception message: An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'myLoggerExtension' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions. Parameter name: element (C:\Documents and Settings\Andrew Shepherd\My Documents\Visual Studio 2008\Projects\WcfPractice\ChatClient\bin\Debug\ChatClient.vshost.exe.config line 5) I know that I've correctly written the reference to the ClientLoggingEndpointBehaviourExtensionobject, because through the debugger I can see it being instantiated.

    Read the article

  • php $_FILES error code returning an unexpected error

    - by EmmyS
    I have some code that allows users to upload multiple files at once. It was never getting to a specific point after the upload, so I put in an echo to test for the value of the error code, and it's returning a value that I'm not sure I understand. Here's the code: $tmpTarget = PCBUG_UPLOADPATH; foreach ($_FILES["attachments"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["attachments"]["tmp_name"][$key]; $name = str_replace(" ", "_", $_FILES["attachments"]["name"][$key]); move_uploaded_file($tmp_name, "$tmpTarget/$name"); @unlink($_FILES["attachments"]["tmp_name"][$key]); } else { $errorFlag = true; echo "error = $error"; exit; } } The code that creates the attachments field looks like this: for($i=1; $i<=$max_no_img; $i++){ echo "<input type=file name='attachments[]' class='bginput'><br />"; } where $max_no_img is a variable set further up in the code, and PCBUG_UPLOAD path is a constant defined in an included file. Here's what's confusing: after I submit my form, I go and look in my uploads directory, and the files I've selected through the form are there - they uploaded correctly. However, the code is jumping into the else clause and $error is returning 4, which the php manual indicates means that no file was uploaded. Any ideas? The files very clearly are getting where they're supposed to. Is there some other definition of "uploaded" that isn't happening?

    Read the article

  • Restricting access to a subdirectory on linux

    - by David
    I'm looking for a way to make a directory accessible only to its parent directories. That is, suppose you have two directories, A and B, at the same level in the file hierarchy. Now suppose that you have a directory A' which is a subdirectory of A. I'd like to enforce that A is able to access the contents of A' but B is not. My problem is that I'd like to use a library (directory A) which builds on top of a legacy version of another library (directory A'). At the same time, I want to be able to use the newest version of this legacy library (directory B). I want to make sure that people aren't somehow using library A and linking against new library B by enforcing that library A must use library A'. I could just link A against library B, but then I'm risking compatibility.

    Read the article

  • CodePlex Daily Summary for Sunday, May 30, 2010

    CodePlex Daily Summary for Sunday, May 30, 2010New ProjectsAviva Solutions C# Coding Guidelines: A set of C# coding guidelines, coding standards, layout rules, FxCop rulesets and (upcoming) custom FxCop and StyleCop rules for improving the over...BKWork: private project.classbook: du an trong vong 10 ngay. Nhom (Do Bao Linh, Phan Thanh Tai, Nguyen Dang Loc)Du an - 01: Du an mon thay LuongEndNote助手: EndNote Helper is a assistant tool for EndNote, which make your task of reference management more convinent. EndNote 助手是一个用于辅助EndNote进行文献管理的小工具,它可...Evoucher: Simple Evoucher Sales SystemFiddler Delayed Responses Extension: A fiddler extension that help developers delay the delivery of HTML Responses to applications. Some delay user stories: - Delivery of css to HTML ...Generic Entity Model 2: GEM2 is lightweight entity framework for building custom business solutions. It enables rapid approach to entity logic design, while offering out o...GY06: 这个是长大工院于2009年发起的项目,因为种种原因没有完成。JoshDOS: JoshDOS is a command line operating system kernel based off COSMOS. It can be booted from actual hardware and built in Visual Studio using .NET la...PhysicsFMUDeluxe.NET: Este projeto é desenvolvido com o intuíto de treinar o desenvolvimento de aplicações em C#. Ele contém ferramentas para cálculos de física e matemá...Reactor Services Platform: Reactor is a service composition and deployment grid that streamlines developing, composing, deploying and managing services. Reactor Services are ...SerafinApartment: Simple MVC 2 application for apartment rental. It is multingual booking system, that allows users to register, book and subscribe for notifications...Silverlight Audio Effect Box: This is a C# Silverlight 4 sample application which process audio sample in near real time. It allows to capture the default audio input device and...Smart Voice: Smart Voice let's you control Skype using your voice. It allows you to write messages, issue phone calls, etc. This application was developed think...WebDotNet - The minimalist web framework inspired by web.py: WebDotNet is an experiment in web frameworks. Inspired by the python web framework, web.py, it is an exercise in extreme minimalism in a framework...New ReleasesAcies: Acies - Alpha Build 0.0.7: Alpha release. Requires Microsoft XNA Framework Redistributable 3.1 (http://www.microsoft.com/downloads/details.aspx?FamilyID=53867a2a-e249-4560-...AdventureWorksLT 2008 Sample Database Script: AdventureWorksLT 2008 R2 DB Script: This script is based on latest download from the Sample database for SQL Server 2008 R2. The original download from the sample is approx 84 MB and ...ASP.NET Wiki Control: Release 1.3.1: - Removed ASP.NET Session dependency. BreadCrumbs will now work with sessions disabled. Can now also share a URL and have the breadcrumb appropriat...Aviva Solutions C# Coding Guidelines: Visual Studio 2010 Rule Sets: Rule Sets targetting different styles of projects.bvcms - Bellevue Church Management System: Source: This source was used to build the latest {church}.bvcms.comCC.Yacht: CC.Yacht 1.0.10.529: This is the initial release of CC.Yacht. Marked as beta since I don't have any testing/feedback beyond that of myself and my wife.Community Forums NNTP bridge: Community Forums NNTP Bridge V14: Release of the Community Forums NNTP Bridge to access the social and anwsers MS forums with a single, open source NNTP bridge. This release has add...Community Forums NNTP bridge: Community Forums NNTP Bridge V15: Release of the Community Forums NNTP Bridge to access the social and anwsers MS forums with a single, open source NNTP bridge. This release has add...Coronasoft Cryostasis scripting engine: CCSE v0.0.1.0 BETA: This is the 0.0.1.0 Beta Release. If you find any bugs Post them as a comment or in the Discussions tabEndNote助手: EndNote助手2.1.0..0: 去除了注册验证机制。Fiddler Delayed Responses Extension: v0.1: Version 0.1 of Fiddler Delayed Responses Extension. See ChangeLog for more information.Generic Entity Model 2: GEM2 build 52510: This is first BETA release of GEM2! Following implementation is still missing from initial plan: Detailed documentation MySQL operational databa...JoshDOS: JoshDOS Souce: This is the souce for the JoshDOS 1.0 OS kernel. You need the COSMOS user kit to use.JoshDOS: Shell Version 1.0: Whats in this download *JoshDOS user kit *JoshDOS VStudio starter kit *JoshDOS documentation Note: You will need the COSMOS user kit to start deve...miniTodo: mini Todo version 0.3: Todo完了時に音が出なかったのを修正Model Virtual Casting - ASPItalia.com: Model Virtual Casting 0.2: Model Virtual Casting 0.2Questa seconda release di ModelVC è corrispondente a quella mostrata in occasione della Real Code Conference 4.0 tenutasi ...PhysicsFMUDeluxe.NET: PhysicsFMUDeluxe.NET - Setup: Primeira versão pública do PhysicsFMUDeluxe.NETSilverlight Audio Effect Box: Echo Box 1.0: First realease - zip contains : web page + xap file :Smart Voice: Smart Voice 0.1: Here is the first alpha release of Smart Voice. Please remember this was done for a curricular unit project at my university and i understand that ...StyleCop Contrib: Custom rules v0.2: This release of the custom rules target StyleCop 4.3.3. Included rules are: Spacing Rules - NoTrailingWhiteSpace - IndentUsingTabs Ordering Rules ...System.ComponentModel.DataAnnotations Contrib: 0.2.46280.0: Built with Visual Studio 2010/.Net 4.0. Compiled from source code changeset 46280.VB Styler: VB Styler Suite V 1.3.0.0: This is the newest version of the VB Styler. Here are the new features. New Imaging ColorPicker A template for getting colors via sliders ColorR...VCC: Latest build, v2.1.30529.0: Automatic drop of latest buildWPF Application Framework (WAF): WPF Application Framework (WAF) 1.0.0.90 RC: Version: 1.0.0.90 (Release Candidate): This release contains the source code of the WPF Application Framework (WAF) and the sample applications. ...XNA Collision Detection: XNA Collision Detection Sample Program: I have coded a compact program which shows the collision detection working, and provides a camera class for rendering and moving the "player." Agai...Most Popular ProjectsRawrWBFS ManagerAJAX Control ToolkitMicrosoft SQL Server Product Samples: DatabaseSilverlight ToolkitWindows Presentation Foundation (WPF)patterns & practices – Enterprise LibraryMicrosoft SQL Server Community & SamplesPHPExcelASP.NETMost Active ProjectsAStar.netpatterns & practices – Enterprise LibraryCommunity Forums NNTP bridgeBlogEngine.NETGMap.NET - Great Maps for Windows Forms & PresentationIonics Isapi Rewrite FilterRawrCustomer Portal Accelerator for Microsoft Dynamics CRMFacebook Developer ToolkitPAP

    Read the article

  • Send keystrokes to TextBox

    - by tanascius
    I have a derived TextBox where I intercept the userinput to manipulate it. However I have to preserve the original typed input. So my idea was to hold an inner TextBox within my derived class and send the user's input to that TextBox before manipulating it. The reason for this approach is that I do not want to take care of all this special actions like: typing something, ctrl+a, [del], type something else, [backspace] and so on ... However I do not know how to send a single keystroke (keycode, ascii, char) to a TextBox. Maybe you have another idea without an inner TextBox at all? Thank you!

    Read the article

  • Can you add identity to existing column in sql server 2008?

    - by bmutch
    In all my searching I see that you essentially have to copy the existing table to a new table to chance to identity column for pre-2008, does this apply to 2008 also? thanks. most concise solution I have found so far: CREATE TABLE Test ( id int identity(1,1), somecolumn varchar(10) ); INSERT INTO Test VALUES ('Hello'); INSERT INTO Test VALUES ('World'); -- copy the table. use same schema, but no identity CREATE TABLE Test2 ( id int NOT NULL, somecolumn varchar(10) ); ALTER TABLE Test SWITCH TO Test2; -- drop the original (now empty) table DROP TABLE Test; -- rename new table to old table's name EXEC sp_rename 'Test2','Test'; -- see same records SELECT * FROM Test;

    Read the article

  • Automatically connect to a DB in a swing application

    - by Oussama
    Hello, I m working on a single user swing application that access an hsqldb database. How can i Automatically run the DB server when a user run the application.? for example, after i finish development i will put the application into an exe file. If the exe file is distributed to multiple users. How can the DB server run and the DB be created when the user run the exe file? Thanks

    Read the article

  • Best Approach to process images in Django

    - by primalpop
    I've have an application with Android front end and Django as the back end. As part of the answers here, I'm confused over the approach which I should take to send images to Django Server. I've 2 options at my disposal as Piro pointed out there. 1) Sending images as Multi Part entity 2) Send image as a String after encoding it using Base 64. So I am considering the approach that would make it easy to be processed by Django. The images are small in size (<200kb) and number (<10). Any suggestions or pointers are most welcome.

    Read the article

  • How to learn Haskell

    - by anderstornvig
    For a few days I've tried to wrap my head around the functional programming paradigm in Haskell. I've done this by reading tutorials and watching screencasts, but nothing really seems to stick. Now, in learning various imperative/OO languages (like C, Java, PHP), excercises have been a good way for me to go. But since I don't really know what Haskell is capable of and because there are many new concepts to utilize, I haven't known where to start. So, how did you learn Haskell? What made you really "break the ice"? Also, any good ideas for beginning excercises?

    Read the article

  • CakePHP requestAction and eval code

    - by Naveed
    Hi, I am using cakephp for my site. I have stored multiple blocks in database and trying to access the code with following syntax. foreach($blocks as $block){ if($block['Block']['position'] == 'left'){ $str = $block['Block']['value']; eval("\"echo $str\";"); } } And i m getting this error; : Undefined property: View::$requestAction [APP\views\layouts\home.ctp(60) : eval()'d code Your Help will be highly appreciated. Thanks,

    Read the article

  • Cannot find wireless driver for HP laptop

    - by rodey
    I have an HP laptop (model: dv7-1267cl, Windows 7 64-bit Home Premium) and I cannot find the wireless driver for the laptop. I am need of a different version because my wireless connection under Windows is flaky and unreliable. I have problems printing to my wireless printer and logging in to and using several sites like reddit.com, phoenix.edu and facebook.com - I get several "page cannot be displayed" messages while using my wireless connection. I disable my wireless adapter and use an ethernet cable and it all works fine. I also used an Ubuntu Live CD to confirm that there is not a problem with the hardware. This is software/driver issue. The drivers were auto installed by the OS. The Device Manager shows the wireless adapter as Atheros AR5009 802.11 a/g/n WiFi Adapter. I have checked the HP website for my laptop and they do not have wireless drivers listed for that model wireless adapter. I have also checked with atheros.com and I do not see my model adapter on their list of available hardware. Device Manager lists the Hardware ID's for my adapter as: PCI\VEN_168C&DEV_002A&SUBSYS_1381103C&REV_01 PCI\VEN_168C&DEV_002A&SUBSYS_1381103C PCI\VEN_168C&DEV_002A&CC_028000 PCI\VEN_168C&DEV_002A&CC_0280 A search for the first Hardware ID turned up this question from experts-exchange.com. tl;dr A driver does not exist for that model adapter.

    Read the article

  • C++ templates error: instantiated from 'void TestClass::testMethod(T, std::map) [with T = SomeClass]

    - by pureconsciousness
    Hello there, I've some problem in my code I cannot deal with: #ifndef TESTCLASS_H_ #define TESTCLASS_H_' #include <map> using namespace std; template <typename T> class TestClass { public: TestClass(){}; virtual ~TestClass(){}; void testMethod(T b,std::map<T,int> m); }; template <typename T> void TestClass`<T`>::testMethod(T b,std::map<T,int> m){ m[b]=0; } #endif /*TESTCLASS_H_*/ int main(int argc, char* argv[]) { SomeClass s; TestClass<SomeClass> t; map<SomeClass,int> m; t.testMethod(s,m); } Compiler gives me following error in line m[b]=0; : instantiated from 'void TestClass::testMethod(T, std::map) [with T = SomeClass] Could you help find the problem?? Thanks in advance

    Read the article

  • jquery.append() - only the last element of my list is appended, previous ones are erased

    - by jaes
    Hi, I have a page like this : <div id="daysTable"> <div id="day0" class="day"></div> <div id="day1" class="day"></div> <div id="day2" class="day"></div> <div id="day3" class="day"></div> <div id="day4" class="day"></div> <div id="day5" class="day"></div> <div id="day6" class="day"></div> </div> and some javascript to fill my calendar like this function getWeek(){ $.getJSON("/getWeek",function(events){ var eventHeight = $("#hoursTable > div").height(); var eventWidth = $("#daysTable > div").width(); var startWeek = events[0]// timestamp of the start of the week for(var i = 1; i < events.length; i ++){ $(".day").empty(); var startHour = (events[i].startDate - startWeek)/3600 var duration = (events[i].stopDate - startWeek)/3600 - startHour var dayStart = Math.floor(startHour/24); var startHour = startHour - dayStart * 24 divEvent = $('<div id="event'+events[i].idEvent+'"/>') .width(eventWidth-2) .height(duration*eventHeight) .css("border","1px solid black") .css("margin-top",startHour*eventHeight) .html(events[i].name); divEvent.appendTo("#day"+dayStart); console.log(divEvent); } }); } my problem being : events contain 3 element I'd like to display but only the last is displayed. If I stop my "for" at the first iteration I can see the first div appended, but it seems that if my loop goes for three iteration the two previous are deleted. The console.log() display some "not-anymore" existing element. Any idea ?

    Read the article

  • dojox.grid.DataGrid populated from Servlet

    - by jeff porter
    I'd like to hava a Dojo dojox.grid.DataGrid with its data from a servlet. Problem: The data returned from the servlet does not get displayed, just the message "Sorry, an error has occured". If I just place the JSON string into the HTML, it works. ARRRRGGH. Can anyone please help me! Thanks Jeff Porter Servlet code... public void doGet(HttpServletRequest req, HttpServletResponse resp) { res.setContentType("json"); PrintWriter pw = new PrintWriter(res.getOutputStream()); if (response != null) pw.println("[{'batchId':'2001','batchRef':'146'}]"); pw.close(); } HtmL code... <div id="gridDD" dojoType="dojox.grid.DataGrid" jsId="gridDD" style="height: 600x; width: 100%;" store="ddInfo" structure="layoutHtmlTableDDDeltaSets"> </div> var rawdataDDInfo = ""; // empty at start ddInfo = new dojo.data.ItemFileWriteStore({ data: { identifier: 'batchId', label: 'batchId', items: rawdataDDInfo } }); <script> function doSelectBatchsAfterDate() { var xhrArgs = { url: "../secure/jsonServlet", handleAs: "json", preventCache: true, load: function(data) { var xx =dojo.toJson(data); var ddInfoX = new dojo.data.ItemFileWriteStore({data: xx}); dijit.byId('gridDD').setStore(ddInfoX); }, error: function(error) { alert("error:" + error); } } //Call the asynchronous xhrGet var deferred = dojo.xhrGet(xhrArgs); } </script> <img src="go.gif" onclick="doSelectBatchsAfterDate();"/>

    Read the article

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