Search Results

Search found 1557 results on 63 pages for 'daniel k'.

Page 48/63 | < Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >

  • What's the "right" way to get Win32 p/Invoke declarations?

    - by Daniel Earwicker
    I typically use the site http://www.pinvoke.net/ to grab a DllImport declaration whenever I need to call a Win32 API, and I've noticed it's the de facto standard response on Stack Overflow to API interop questions. Is this what "everyone" does? Is there a better way? Does Microsoft offer an alternative? e.g. a tool that reads .h files and outputs an assembly. Why aren't there some standard assemblies that just expose all the Win32 APIs? What would be the barrier to creating them and using them, as an alternative to a site like pinvoke.net?

    Read the article

  • How do I serialize/deserialize a NHibernate entity that has references to other objects?

    - by Daniel T.
    I have two NHibernate-managed entities that have a bi-directional one-to-many relationship: public class Storage { public virtual string Name { get; set; } public virtual IList<Box> Boxes { get; set; } } public class Box { public virtual string Box { get; set; } [DoNotSerialize] public virtual Storage ParentStorage { get; set; } } A Storage can contain many Boxes, and a Box always belongs in a Storage. I want to edit a Box's name, so I send it to the client using JSON. Note that I don't serialize ParentStorage because I'm not changing which storage it's in. The client edits the name and sends the Box back as JSON. The server deserializes it back into a Box entity. Problem is, the ParentStorage property is null. When I try to save the Box to the database, it updates the name, but also removes the relationship to the Storage. How do I properly serialize and deserialize an entity like a Box, while keeping the JSON data size to a minimum?

    Read the article

  • How can I write a file on an sftp-server with PHP?

    - by Daniel
    Hi, I hope someone here could help me, because I couldn't find any solution with Google. What I have to do is to generate a XML-string (that works) an save that directly into a file on an sftp-server. So far, so good... I used the following code with ftp and it works to, but not with ftps. So I either need another options-configuration for the stream or a different way to solve that task. Here my current code: $host = 'ftp.example.com'; $port = 22; $user = 'xxxxxx'; $pass = 'xxxxxx'; $file = 'test_' . time() . '.txt'; $ftpPath = sprintf('ftp://%s:%s@%s:%d/%s', $user, $pass, $host, $port, $file); $context = stream_context_create(array('ftp' = array('overwrite' = true))); file_put_contents($ftpPath, 'test', 0, $context);

    Read the article

  • Log4net 1.2.10 running on .NET 1.1 and 2.0 not compatible

    - by Daniel Williams
    I have old code that uses log4net version 1.2.10 targeted for the .NET 1.1 platform. My current code uses lognet version 1.2.10 targeted for the .NET 2.0 platform When I mix the old and new code all hell breaks loose. Code written today on .NET 4.0 and VS2010 can use the 2.0 log4net dll just fine. but if I put in the 1.1 version, it breaks. Conversely, the old dlls will break if I use the 2.0 log4net dll. I do not want to force my old dlls onto 2.0. Is there a good solution? I guess what bugs me most is that the log4net has the same version number, but I cannot fool my code and dlls into working with a single version.

    Read the article

  • What's the best way to set cursor/caret position?

    - by Daniel Bachhuber
    If I'm inserting content into a textarea that TinyMCE has co-opted, what's the best way to set the position of the cursor/caret? I'm using tinyMCE.execCommand("mceInsertRawHTML", false, content); to insert the content, and I'd like set the cursor position to the end of the content. Both document.selection and myField.selectionStart won't work for this, and I feel as though this is going to be supported by TinyMCE (through something I can't find on their forum) or it's going to be a really ugly hack. Later: It gets better; I just figured out that, when you load TinyMCE in WordPress, it loads the entire editor in an embedded iframe. Later (2): I can use document.getElementById('content_ifr').contentDocument.getSelection(); to get the selection as a string, but not a Selection Object that I can use getRangeAt(0) on. Making progress little by little.

    Read the article

  • Create an Edit view similar to Contacts App

    - by Daniel Granger
    I have an edit view in my app which is a instance of UITableViewController and contains one cell with a textfield in a grouped table. At the moment this cell is at the top of the screen and is firstResponder so they keyboard is visible as well. But in all the Apples apps like the Contacts App when you edit a piece of information like an Email it buts both of its rows in the middle between the Nav Bar and the Keyboard not at the top of the screen. How do I achieve this effect? Many Thanks

    Read the article

  • Forwarding HTTP Request with Direct Server Return

    - by Daniel Crabtree
    I have servers spread across several data centers, each storing different files. I want users to be able to access the files on all servers through a single domain and have the individual servers return the files directly to the users. The following shows a simple example: 1) The user's browser requests http://www.example.com/files/file1.zip 2) Request goes to server A, based on the DNS A record for example.com. 3) Server A analyzes the request and works out that /files/file1.zip is stored on server B. 4) Server A forwards the request to server B. 5) Server B returns file1.zip directly to the user without going through server A. Note: steps 4 and 5 must be transparent to the user and cannot involve sending a redirect to the user as that would violate the requirement of a single domain. From my research, what I want to achieve is called "Direct Server Return" and it is a common setup for load balancing. It is also sometimes called a half reverse proxy. For step 4, it sounds like I need to do MAC Address Translation and then pass the request back onto the network and for servers outside the network of server A tunneling will be required. For step 5, I simply need to configure server B, as per the real servers in a load balancing setup. Namely, server B should have server A's IP address on the loopback interface and it should not answer any ARP requests for that IP address. My problem is how to actually achieve step 4? I have found plenty of hardware and software that can do this for simple load balancing at layer 4, but these solutions fall short and cannot handle the kind of custom routing I require. It seems like I will need to roll my own solution. Ideally, I would like to do the routing / forwarding at the web server level, i.e. in PHP or C# / ASP.net. However, I am open to doing it at a lower level such as Apache or IIS, or at an even lower level, i.e. a custom proxy service in front of everything.

    Read the article

  • Will C++1x support __stdcall or extern "C" capture-nothing lambdas?

    - by Daniel Trebbien
    Yesterday I was thinking about whether it would be possible to use the convenience of C++1x lambda functions to write callbacks for Windows API functions. For example, what if I wanted to use a lambda as an EnumChildProc with EnumChildWindows? Something like: EnumChildWindows(hTrayWnd, CALLBACK [](HWND hWnd, LPARAM lParam) { // ... return static_cast<BOOL>(TRUE); // continue enumerating }, reinterpret_cast<LPARAM>(&myData)); Another use would be to write extern "C" callbacks for C routines. E.g.: my_class *pRes = static_cast<my_class*>(bsearch(&key, myClassObjectsArr, myClassObjectsArr_size, sizeof(my_class), extern "C" [](const void *pV1, const void *pV2) { const my_class& o1 = *static_cast<const my_class*>(pV1); const my_class& o2 = *static_cast<const my_class*>(pV2); int res; // ... return res; })); Is this possible?

    Read the article

  • Force Tab Activity creation?

    - by Daniel
    I have a TabHost and several tabs added to it. Problem: The activities on these tabs are not created until the tab is pressed. My tabhost is broadcasting intents but my broadcast receivers are not registered until onCreate in my tab activities is called. Is there any way to force activity creation? Maybe my tabhost can call setCurrentTab and switch back to main tab(0), but is that really the best option available?

    Read the article

  • Why does cisco IOS require domain-name to be set before SSH keys can be generated?

    - by Daniel Papasian
    Is there a technical reason why IOS requires the device's domain-name to be set (via ip domain-name) before an SSH key can be generated? Is the domain-name used in any way in the generation of the key? Is there any way to force the generation of a key before the domain name is set? UPDATE: Myself (before I posted this question) and others in your answer seem to think it may be used as either a salt or a source of entropy for the key. Wouldn't the domain-name be very predictable? This doesn't seem like a suitable source of entropy.

    Read the article

  • As a Web Developer, how complicated is your average job? [closed]

    - by Daniel S
    Hey people, I'm 16 years old and I've recently started to do freelance jobs. I've been playing with PHP since I was 12 and I think that I can code reasonably well. So far, I've created a library for fetching info from LinkedIn profiles and some Wordpress plugins. Right now this client wants me to convert an HTML template into a Wordpress theme for using as a website. I feel this is a tad easy, so I wanted to ask, as professional web programmers, are most assignments harder than this?

    Read the article

  • Move to php in windows? Concern, hints, "please don't do!"?

    - by Daniel
    I am considering to move frome Microsoft languages to PHP (just for web dev) which has quite an interesting syntax, a perlish look (but a wider programmer base) and it allows me to reuse the web without reinventing it. I have some concerns too. I would be more than happy to gather some wisdom from stackoverflow community, (challenge to my opinions warmly welcome). Here are my doubts. Efficiency. Cgi are slow, what I am supposed to use? Fastcgi? Or what else? Efficiency + stability. Is PHP on windows really stable and a good choice in terms of performances? Database. I use very often MSSQL (I regret, i like it). Could I widely and efficiently interface PHP with MSSQL (using smartly stored pro, for example). XSLT + XML performance. I work quite a lot with XML and XSLT and I really find the MS xml parser a great software component. Are parser used in PHP fast, reliable and efficient (I am interested mainly in DOM, not SAX)? Objects. Is the PHP object programming model valid end efficient? 6 Regex. How efficient is PHP processing regexp? Many thanks for your advices.

    Read the article

  • gzip several files and pipe them into one input

    - by Daniel
    I have this program that takes one argument for the source file and then it parse it. I have several files gzipped that I would like to parse, but since it only takes one input, I'm wondering if there is a way to create one huge file using gzip and then pipe it into the only one input.

    Read the article

  • c# video equivalent to image.fromstream? Or changing the scope of the following script to allow vide

    - by Daniel
    The following is a part of an upload class in a c# script. I'm a php programmer, I've never messed with c# much but I'm trying to learn. This upload script will not handle anything except images, I need to adapt this class to handle other types of media also, or rewrite it all together. If I'm correct, I realize that using (Image image = Image.FromStream(file.InputStream)) basically says that the scope of the following is Image, only an image can be used or the object is discarded? And also that the variable image is being created from an Image from the file stream, which I understand to be, like... the $_FILES array in php? I dunno, I don't really care about making thumbnails right now either way, so if this can be taken out and still process the upload I'm totally cool with that, I just haven't had any luck getting this thing to take anything but images, even when commenting out that whole part of the class... protected void Page_Load(object sender, EventArgs e) { string dir = Path.Combine(Request.PhysicalApplicationPath, "files"); if (Request.Files.Count == 0) { // No files were posted Response.StatusCode = 500; } else { try { // Only one file at a time is posted HttpPostedFile file = Request.Files[0]; // Size limit 100MB if (file.ContentLength > 102400000) { // File too large Response.StatusCode = 500; } else { string id = Request.QueryString["userId"]; string[] folders = userDir(id); foreach (string folder in folders) { dir = Path.Combine(dir, folder); if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); } string path = Path.Combine(dir, String.Concat(Request.QueryString["batchId"], "_", file.FileName)); file.SaveAs(path); // Create thumbnail int dot = path.LastIndexOf('.'); string thumbpath = String.Concat(path.Substring(0, dot), "_thumb", path.Substring(dot)); using (Image image = Image.FromStream(file.InputStream)) { // Find the ratio that will create maximum height or width of 100px. double ratio = Math.Max(image.Width / 100.0, image.Height / 100.0); using (Image thumb = new Bitmap(image, new Size((int)Math.Round(image.Width / ratio), (int)Math.Round(image.Height / ratio)))) { using (Graphics graphic = Graphics.FromImage(thumb)) { // Make sure thumbnail is not crappy graphic.SmoothingMode = SmoothingMode.HighQuality; graphic.InterpolationMode = InterpolationMode.High; graphic.CompositingQuality = CompositingQuality.HighQuality; // JPEG ImageCodecInfo codec = ImageCodecInfo.GetImageEncoders()[1]; // 90% quality EncoderParameters encode = new EncoderParameters(1); encode.Param[0] = new EncoderParameter(Encoder.Quality, 90L); // Resize graphic.DrawImage(image, new Rectangle(0, 0, thumb.Width, thumb.Height)); // Save thumb.Save(thumbpath, codec, encode); } } } // Success Response.StatusCode = 200; } } catch { // Something went wrong Response.StatusCode = 500; } } }

    Read the article

  • How to get function's name from function's pointer in C?

    - by Daniel Silveira
    How to get function's name from function's pointer in C? Edit: The real case is: I'm writing a linux kernel module and I'm calling kernel functions. Some of these functions are pointers and I want to inspect the code of that function in the kernel source. But I don't know which function it is pointing to. I thought it could be done because, when the system fails (kernel panic) it prints out in the screen the current callstack with function's names. But, I guess I was wrong... am I?

    Read the article

< Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >