Search Results

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

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

  • 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

  • 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

  • How can I make one Maven module depend on another?

    - by Daniel Pryden
    OK, I thought I understood how to use Maven... I have a master project M which has sub-projects A, B, and C. C contains some common functionality (interfaces mainly) which is needed by A and B. I can run mvn compile jar:jar from the project root directory (the M directory) and get JAR files A.jar, B.jar, and C.jar. (The versions for all these artifacts are currently 2.0-SNAPSHOT.) The master pom.xml file in the M directory lists C under its <dependencyManagement> tag, so that A and B can reference C by just including a reference, like so: <dependency> <groupId>my.project</groupId> <artifactId>C</artifactId> </dependency> So far, so good. I can run mvn compile from the command line and everything works fine. But when I open the project in NetBeans, it complains with the problem: "Some dependency artifacts are not in the local repository", and it says the missing artifact is C. Likewise from the command line, if I change into the A or B directories and try to run mvn compile I get "Build Error: Failed to resolve artifact." I expect I could manually go to where my C.jar was built and run mvn install:install-file, but I'd rather find a solution that enables me to just work directly in NetBeans (and/or in Eclipse using m2eclipse). What am I doing wrong?

    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

  • I have a fucntion that create histogram of each Bitmap. How can i create another 3 histograms for R.G.B of each Bitmap?

    - by Daniel Lip
    This is the histogram function im using today and if im not worng it's creating an histogram by Gray color. What i want is another fucntion that will return me 3 histograms of each Bitmap: The first histogram will be of the Red color of the bitmap the second for the Green color and the last one for the Blue color. public static long[] GetHistogram(Bitmap b) { long[] myHistogram = new long[256]; BitmapData bmData = null; try { //Lock it fixed with 32bpp bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); int scanline = bmData.Stride; System.IntPtr Scan0 = bmData.Scan0; unsafe { byte* p = (byte*)(void*)Scan0; int nWidth = b.Width; int nHeight = b.Height; for (int y = 0; y < nHeight; y++) { for (int x = 0; x < nWidth; x++) { long Temp = 0; Temp += p[0]; // p[0] - blue, p[1] - green , p[2]-red Temp += p[1]; Temp += p[2]; Temp = (int)Temp / 3; myHistogram[Temp]++; //we do not need to use any offset, we always can increment by pixelsize when //locking in 32bppArgb - mode p += 4; } } } b.UnlockBits(bmData); } catch { try { b.UnlockBits(bmData); } catch { } } return myHistogram; } How may i do it ?

    Read the article

  • How do you create a Google Maps-esque drop down dialog?

    - by Daniel Lew
    In the Google Maps application, when you open the menu and click on "Directions", it pops up a dialog that is unique to Google Maps. It keeps the MapView in the background, but displays the search dialog from the top (or bottom, if you're on an old version of Android). I was curious if anyone knew how they achieved this effect. I'm willing to create a custom Dialog, but it seems that Dialogs are designed to pop into the middle of the screen (any other types of dialogs are denied permission as system dialogs). What trick is Google Maps using?

    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

  • 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

  • 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

  • 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

  • ((System.Object)p == null)

    - by Daniel Bryars
    Why do this: // If parameter cannot be cast to Point return false. TwoDPoint p = obj as TwoDPoint; if ((System.Object)p == null) { return false; } Instead of this: // If parameter cannot be cast to Point return false. TwoDPoint p = obj as TwoDPoint; if (p == null) { return false; } I don't understand why you'd ever write ((System.Object)p)? Regards, Dan

    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

  • NHibernate : Root collection with an root object

    - by Daniel
    Hi, I want to track a list of root objects which are not contained by any element. I want the following pseudo code to work: IList<FavoriteItem> list = session.Linq<FavoriteItem>().ToList(); list.Add(item1); list.Add(item2); list.Remove(item3); list.Remove(item4); var item5 = list.First(i => i.Name = "Foo"); item5.Name = "Bar"; session.Save(list); This should automatically insert item1 and item2, delete item3 and item3 and update item5 (i.e. I don't want to call sesssion.SaveOrUpdate() for all items separately. Is it possible to define a pseudo entity that is not associated with a table? For example I want to define the class Favorites and map 2 collection properties of it and than I want to write code like this: var favs = session.Linq<Favorites>(); favs.FavoriteColors.Add(new FavoriteColor(...)); favs.FavoriteMovies.Add(new FavoriteMovie(...)); session.SaveOrUpdate(favs); FavoriteColors and FavoriteMovies are the only properties of the Favorites class and are of type IList and IList. I do only want to persist the these two collection properties but not the Favorites class. Any help is much appreciated.

    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

  • Named Range Breaks Code

    - by Daniel
    I have one workbook with several sheets. I populate the listboxes (pulling static data from cells) on the 2nd sheet, click a button and it runs fine. When I populate the listboxes with a named range, the listbox populates the way I want, but I get an error because the code thinks that I didn't select anything in the listbox, even though I did. So it passes through "" instead of "title". Is this a common issue? The named range isn't a problem because it passes through the data to the listbox and I know it's selecting data because as soon as the listbox loses focus, it spits out the contents of the cell into cell A1. What's even stranger is that I have the contents of the listbox set to Msg1. So A1 gets populated with Msg1 (what I actually selected in the listbox). But when I try and use Msg1 in the code, it tells me that Msg1 is "". Again, this only happens when I use the dynamic named range, not with static data in cells K1:K9. Private Function strEndSQL1 As String Dim strSQL As String strSQL = "" 'Create SQL statement strSQL = "FROM (SELECT * FROM dbo.Filter WHERE ID = " & TextBox1.Text & " And Source IN (" & Msg1 & ")) a FULL OUTER JOIN " strSQL = strSQL & "(SELECT * FROM dbo.Filters WHERE ID = " & TextBox2.Text & " And Source IN (" & Msg1 & ")) b " strSQL = strSQL & "ON a.Group = b.Group strEndSQL = strSQL End Function

    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

  • Which Java MVC frameworks integrate easily with StringTemplate?

    - by Daniel Jomphe
    It's hard to see how StringTemplate integrates easily (or not) with popular Java web MVC frameworks. Which Java MVC frameworks integrate easily with StringTemplate? A good answer: mentions one solution to integrate with a framework, includes a link to something useful and applicable, like: a tutorial, or documentation, or a reference to source code: free, and open source or public domain. Readers/Voters, please vote for a solution if you know it's true and great. In the scope of this question, I am not interested in any other templating engine than StringTemplate.

    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

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