Search Results

Search found 1742 results on 70 pages for 'combine'.

Page 14/70 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Easiest way to combine a dataset and other data in a single file?

    - by Tim Gradwell
    I have a dataset in C# which I can serialise using dataset.WriteXml(filename); but I want the file to contain other data as well (essentially some meta data about the dataset). I could add another table to the dataset which contained the metadata, but I'd prefer to keep it separate, if at all possible. Essentially I think I want to create a 'combination of files' file, that looks something like this: size_of_file1 file1 size_of_file2 file2 ... etc Then, I'd like to load the file into memory, and split the file into separate streams, so that I can feed the dataset into dataset.ReadXml(stream); and the metadata into something else. Sound possible? Can anyone tell me how I can do it? Thanks Tim

    Read the article

  • Is there any way to get the combine two xml into one xml in Linux.

    - by Tattat
    XML one is something like that: <dict> <key>2</key> <array> <string>A</string> <string>B</string> </array> <key>3</key> <array> <string>C</string> <string>D</string> <string>E</string> </array> </dict> XML Two is something like that: <dict> <key>A</key> <array> <string>A1</string> <false/> <false/> <array> <string>Apple</string> <string>This is an apple</string> </array> <array> <string>Apple Pie</string> <string>I love Apple Pie.</string> </array> </array> <key>B</key> <array> <string>B7</string> <false/> <false/> <array> <string>Boy</string> <string>I am a boy.</string> </array> </array> </dict> I want to convert to this: <dict> <key>2</key> <array> <string>A, Apple, Apple Pie</string> <string>B, Boy</string> </array> ... </dict>

    Read the article

  • Is there a way to combine streaming data retrieval with hibernate?

    - by Steve B.
    For the purposes of handling very large collections (and by very large I just mean "likely to throw OutOfMemory exception"), it seems problematic to use Hibernate because normally collection retrieval is done in a block, i.e. List values=session.createQuery("from X").list(), where you monolithically grab all N-million values and then process them. What I'd prefer to do is to retrieve the values as an iterator so that I grab 1000 or so (or whatever's a reasonable page size) at a time. Apart from writing my own iteration (which seems like it's likely to be re-inventing the wheel) is there a hibernate-native way to handle this?

    Read the article

  • How do I combine similar method calls into a delegate pattern?

    - by Daniel T.
    I have three methods: public void Save<T>(T entity) { using (new Transaction()) { Session.Save(entity); } } public void Create<T>(T entity) { using (new Transaction()) { Session.Create(entity); } } public void Delete<T>(T entity) { using (new Transaction()) { Session.Delete(entity); } } As you can see, the only thing that differs is the method call inside the using block. How can I rewrite this so it's something like this instead: public void Save<T>(T entity) { TransactionWrapper(Session.Save(entity)); } public void Create<T>(T entity) { TransactionWrapper(Session.Create(entity)); } public void Save<T>(T entity) { TransactionWrapper(Session.Save(entity)); } So in other words, I pass a method call as a parameter, and the TransactionWrapper method wraps a transaction around the method call.

    Read the article

  • Can you dynamically combine multiple conditional functions into one in Python?

    - by erich
    I'm curious if it's possible to take several conditional functions and create one function that checks them all (e.g. the way a generator takes a procedure for iterating through a series and creates an iterator). The basic usage case would be when you have a large number of conditional parameters (e.g. "max_a", "min_a", "max_b", "min_b", etc.), many of which could be blank. They would all be passed to this "function creating" function, which would then return one function that checked them all. Below is an example of a naive way of doing what I'm asking: def combining_function(max_a, min_a, max_b, min_b, ...): f_array = [] if max_a is not None: f_array.append( lambda x: x.a < max_a ) if min_a is not None: f_array.append( lambda x: x.a > min_a ) ... return lambda x: all( [ f(x) for f in f_array ] ) What I'm wondering is what is the most efficient to achieve what's being done above? It seems like executing a function call for every function in f_array would create a decent amount of overhead, but perhaps I'm engaging in premature/unnecessary optimization. Regardless, I'd be interested to see if anyone else has come across usage cases like this and how they proceeded. Also, if this isn't possible in Python, is it possible in other (perhaps more functional) languages?

    Read the article

  • How to combine two rows and calculate the time difference between two timestamp values in MySQL?

    - by Nadar
    I have a situation that I'm sure is quite common and it's really bothering me that I can't figure out how to do it or what to search for to find a relevant example/solution. I'm relatively new to MySQL (have been using MSSQL and PostgreSQL earlier) and every approach I can think of is blocked by some feature lacking in MySQL. I have a "log" table that simply lists many different events with their timestamp (stored as datetime type). There's lots of data and columns in the table not relevant to this problem, so lets say we have a simple table like this: CREATE TABLE log ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(16), ts DATETIME NOT NULL, eventtype VARCHAR(25), PRIMARY KEY (id) ) Let's say that some rows have an eventtype = 'start' and others have an eventtype = 'stop'. What I want to do is to somehow couple each "startrow" with each "stoprow" and find the time difference between the two (and then sum the durations per each name, but that's not where the problem lies). Each "start" event should have a corresponding "stop" event occuring at some stage later then the "start" event, but because of problems/bugs/crashed with the data collector it could be that some are missing. In that case I would like to disregard the event without a "partner". That means that given the data: foo, 2010-06-10 19:45, start foo, 2010-06-10 19:47, start foo, 2010-06-10 20:13, stop ..I would like to just disregard the 19:45 start event and not just get two result rows both using the 20:13 stop event as the stop time. I've tried to join the table with itself in different ways, but the key problems for me seems to be to find a way to correctly identify the corresponding "stop" event to the "start" event for the given "name". The problem is exactly the same as you would have if you had table with employees stamping in and out of work and wanted to find out how much they actually were at work. I'm sure there must be well known solutions to this, but I can't seem to find them...

    Read the article

  • MySQL - Combine two fields to create a unix timestamp?

    - by Dan
    Hi, I'm trying to retrieve a UNIX timestamp from a query by combining a date and a time field in the table, however it keeps returning as zero. SELECT *, UNIX_TIMESTAMP(startdate starttime) AS start, UNIX_TIMESTAMP(enddate endtime) AS end FROM mytable; Can anyone help me out? Thanks.

    Read the article

  • How do you combine a Move and Rotate effect in Flex 3?

    - by Impirator
    I realize you can make one of each effect, set the same target, and hit .play();, but this produces weird results (acknowledged by Adobe, fixed in Flex 4). I'm trying to have an object move from the top of the screen to the bottom while it rotates around it's own center. When called independently, both of these effects work perfectly. When called together, the object always rotates around the top left corner. I even tried putting them both inside a <Parallel> tag with no success. Has anyone come up with a workaround?

    Read the article

  • How can I combine multiple iPhone applications in to one application?

    - by Toret
    At the moment I have 2 completed iPhone applications. Both these applications must be contained in to one application. I can't have multiple apps on the app store and to avoid confusion among people using these apps I must have them contained to a single application that gives the user the capability to launch any application in the wrapper. How can I go about doing this. Some of the ideas that crossed my mind are: Building a Framework, or building a library. But Im not even sure if I'm heading in the right direction.

    Read the article

  • Is there a way to redirect ONLY stderr to stdout (not combine the two) so it can be piped to other programs

    - by James K
    I'm working in a Windows CMD.EXE environment and would like to change the output of stdout to match that of stderr so that I can pipe error messages to other programs without the intermediary of a file. I'm aware of the 2>&1 notation, but that combines stdout and stderr into a single stream. What I'm thinking of would be something like this: program.exe 2>&1 | find " " But that combines stdout and stderr just like: program.exe | find " " 2>&1 I realize that I could do... program 2>file type file | find " " del file But this does not have the flexibility and power of a program | find " " sort of notation. Doing this requires that program has finished with it's output before that output can be processed.

    Read the article

  • would have only saved the resized images

    - by saadan
    I want it to only saves the resized images so have tried to do so it deletes the original image again after it has been uploaded but can not because it says the image is being used by another process please help. and can not simply remove where it stores the original because it uses it to resize i Use this code to save the fils string tempPath = "Galleryt"; string imgPath = "Gallery"; string savePath = Path.Combine(Request.PhysicalApplicationPath, tempPath); string imgSavePath = Path.Combine(Request.PhysicalApplicationPath, imgPath); string imgSavePath2 = Path.Combine(Request.PhysicalApplicationPath, imgPath); string ProductImageNormal = Path.Combine(imgSavePath, imageName + Fileupload1.PostedFile.FileName); string ProductImagetemp = Path.Combine(savePath, "t__" + imageName + Fileupload1.PostedFile.FileName); string ProductImagetemp2 = Path.Combine(imgSavePath2, "b__" + imageName + Fileupload1.PostedFile.FileName); string extension = Path.GetExtension(Fileupload1.PostedFile.FileName); switch (extension.ToLower()) { case ".png": goto case "Upload"; case ".gif": goto case "Upload"; case ".jpg": goto case "Upload"; case "Upload": Fileupload1.PostedFile.SaveAs(ProductImageNormal); ImageTools.GenerateThumbnail(ProductImageNormal, ProductImagetemp, 250, 350, true, "heigh"); ImageTools.GenerateThumbnail(ProductImageNormal, ProductImagetemp2, 600, 600, true, "heigh"); Label1.Text = ""; break; default: Label1.Text = "Status: Denne filtype er ikke tilladt"; return; } } if i try to delete the original file just after with code File.Delete(Server.MapPath("~/Gallery/" + imageName + Fileupload1.PostedFile.FileName));

    Read the article

  • rounded corners in Qooxdoo - problems with ImageMagic and PNG

    - by lomme47
    Hi, I want to create a button with rounded corners in Qooxdoo but I'm having some problems. I guess it's a problem with ImageMagick and not my Qooxdoo code, but I'll post it anyway. So in order to create rounded corners I'm following this guide Guide this is what my image.json contains: { "jobs" : { "common" : { "let" : { "RESPATH" : "source/resource/custom" }, "cache" : { "compile" : "../cache" } }, "image-clipping" : { "extend" : ["common"], "slice-images" : { "images" : { "${RESPATH}/image/source/groupBox.png" : { "prefix" : "../clipped/groupBox", "border-width" : 4 } } } }, "image-combine" : { "extend" : ["common"], "combine-images" : { "images" : { "${RESPATH}/image-combined/combined.png": { "prefix" : [ "${RESPATH}" ], "layout" : "vertical", "input" : [ { "prefix" : [ "${RESPATH}" ], "files" : [ "${RESPATH}/image/clipped/groupBox*.png" ] } ] } } } } } } Here's what happens when I run image-clipping and image-combine: C:\customgenerate.py -c image.json image-clipping INITIALIZING: CUSTOM Configuration: image.json Jobs: image-clipping Resolving config includes... Resolving jobs... Incorporating job defaults... Resolving macros... Resolving libs/manifests... EXECUTING: IMAGE-CLIPPING Initializing cache... Done C:\customgenerate.py -c image.json image-combine INITIALIZING: CUSTOM Configuration: image.json Jobs: image-combine Resolving config includes... Resolving jobs... Incorporating job defaults... Resolving macros... Resolving libs/manifests... EXECUTING: IMAGE-COMBINE Initializing cache... Combining images... Creating image C:\custom\source\resource\custom\image-combined\combined.png Magick: no decode delegate for this image format \docume~1\lomme\lokala~1\ tmpql73hk' @ error/constitute.c/ReadImage/532. Magick: missing an image filename C:\custom\source\resource\custom\image-combined\combined.png' @ error/montage.c/MontageImageCommand/1707. The montage command (montage -geometry +0+0 -gravity NorthWest -tile 1x -background None @c:\docume~1\lomme\lokala~1\temp\tmpql73hk C:\custom\source\resources\custom\image-combined\combined.png) failed with the following return code:1 The image-clipping works like a charm but I get some kinda error message when I try to run image-combine. When I google the error messages it says ImageMagick is lacking PNG support but I can use other commands like "convert a.jpg b.png" so there must be some kinda png support? here's what "identify -list format" returns: PNG* PNG rw- Portable Network Graphics (libpng 1.2.43) See http://www.libpng.org/ for details about the PNG format. PNG24* PNG rw- opaque 24-bit RGB (zlib 1.2.3) PNG32* PNG rw- opaque or transparent 32-bit RGBA PNG8* PNG rw- 8-bit indexed with optional binary transparency So why do i get this error message: Magick: no decode delegate for this image format Looks to me like there's png support? I've never used ImageMagick before so I'm completely lost :D Thanks in advance

    Read the article

  • I want to combine the databases from two different sites under one URL. How is this possible?

    - by Punct Ulica
    I have a small site that I want to merge with a bigger one. How can I merge the second one with the first? I know that one solution would be to make the smaller one a subdomain of the bigger one, but I would like the following thing to happen: when I click on a category or a tag, posts from both sites/databases would appear. Something like Smashing Magazine did when it assimilated designinformer.com. The other solution and the one that I would prefer would be to merge the two databases, but I don't know if this is possible.

    Read the article

  • How print multiple independent pages in one print job?

    - by C.W.Holeman II
    How can I combine multiple single page prints into a single print job? For example, using Firefox on Linux one can print a web page such that each sheet of paper has four pages printed upon it. I would like to combine several separate web pages so that for example, web-page-a, web-page-b and web-page-c (each less than one print page long) are printed on a single sheet of paper. I would like to do this without having to use some for of image editor to combine them.

    Read the article

  • Hide taskbar labels without combining

    - by Domchi
    There are three options for customizing taskbar buttons in Windows 7: Always combine, hide labels Combine when taskbar is full Never combine Is there any way to hide labels and not combine taskbar buttons? Or even better, to exclude only certain applications from combining? My main problem is that I switch a lot between two instances of a single application, and having to hover over combined icon and then choosing the correct one. Alt-Tabbing is not a good alternative when I'm switching between more than three applications; clicking on taskbar only once is what I'm looking for.

    Read the article

  • Asus Sonic Master on Asus N53SV

    - by David Winchester
    I have read that there's a problem to get the subwoofer working in these laptops. I tried this solution No sound from external subwoofer but I don't how to prove that the subwoofer is properly functioning. I use Pulseaudio equalizer and the bass sound seems to work fine, but when I go to the Sound Settings, I can't move the bar where it says 'Subwoofer' in my sound card option, so I don't know if everything is alright. If someone has a solution I would like to know, because there isn't much information regarding this. By the way, I'm using Ubuntu 12.04 64 bits. Thanks beforehand, Dave EDIT ----------- Possible Solution Well, I will post a solution that worked for me and I think it will help a lot of users. I finally got the subwoofer working. Besides adding in /etc/modprobe.d/alsa-base.conf the line options snd-hda-intel model=asus-mode4 I deleted the lines with load-module module-combine and module-combine-sink in /etc/pulse/default.pa (in the home folder there's also a ~/.pulse/default.pa file, I don't know if it has the lines too) To assure all the channels are working, I think this command tells me that speaker-test -c6 -l1 -twav I use pulseaudio-equalizer and the bass sounds very well when properly adjusted. Also, all the channels seems to work fine and the sound is even better than in Windows (where I don't have an equalizer). I pointed out before a module-combine and module-combine-sink problem, because one day I turned on my laptop and pulseaudio didn't work. So I deleted the lines with that names (don't know if they came by default, maybe I added them sometime when I was trying to fix my speakers). After all this, I can now move the Subwoofer bar in the Sound configuration. Anyways, the Equalizer does a great job and it improves the sound a lot.

    Read the article

  • Python dictionary key missing

    - by Greg K
    I thought I'd put together a quick script to consolidate the CSS rules I have distributed across multiple CSS files, then I can minify it. I'm new to Python but figured this would be a good exercise to try a new language. My main loop isn't parsing the CSS as I thought it would. I populate a list with selectors parsed from the CSS files to return the CSS rules in order. Later in the script, the list contains an element that is not found in the dictionary. for line in self.file.readlines(): if self.hasSelector(line): selector = self.getSelector(line) if selector not in self.order: self.order.append(selector) elif selector and self.hasProperty(line): # rules.setdefault(selector,[]).append(self.getProperty(line)) property = self.getProperty(line) properties = [] if selector not in rules else rules[selector] if property not in properties: properties.append(property) rules[selector] = properties # print "%s :: %s" % (selector, "".join(rules[selector])) return rules Error encountered: $ css-combine combined.css test1.css test2.css Traceback (most recent call last): File "css-combine", line 108, in <module> c.run(outfile, stylesheets) File "css-combine", line 64, in run [(selector, rules[selector]) for selector in parser.order], KeyError: 'p' Swap the inputs: $ css-combine combined.css test2.css test1.css Traceback (most recent call last): File "css-combine", line 108, in <module> c.run(outfile, stylesheets) File "css-combine", line 64, in run [(selector, rules[selector]) for selector in parser.order], KeyError: '#header_.title' I've done some quirky things in the code like sub spaces for underscores in dictionary key names in case it was an issue - maybe this is a benign precaution? Depending on the order of the inputs, a different key cannot be found in the dictionary. The script: #!/usr/bin/env python import optparse import re class CssParser: def __init__(self): self.file = False self.order = [] # store rules assignment order def parse(self, rules = {}): if self.file == False: raise IOError("No file to parse") selector = False for line in self.file.readlines(): if self.hasSelector(line): selector = self.getSelector(line) if selector not in self.order: self.order.append(selector) elif selector and self.hasProperty(line): # rules.setdefault(selector,[]).append(self.getProperty(line)) property = self.getProperty(line) properties = [] if selector not in rules else rules[selector] if property not in properties: properties.append(property) rules[selector] = properties # print "%s :: %s" % (selector, "".join(rules[selector])) return rules def hasSelector(self, line): return True if re.search("^([#a-z,\.:\s]+){", line) else False def getSelector(self, line): s = re.search("^([#a-z,:\.\s]+){", line).group(1) return "_".join(s.strip().split()) def hasProperty(self, line): return True if re.search("^\s?[a-z-]+:[^;]+;", line) else False def getProperty(self, line): return re.search("([a-z-]+:[^;]+;)", line).group(1) class Consolidator: """Class to consolidate CSS rule attributes""" def run(self, outfile, files): parser = CssParser() rules = {} for file in files: try: parser.file = open(file) rules = parser.parse(rules) except IOError: print "Cannot read file: " + file finally: parser.file.close() self.serialize( [(selector, rules[selector]) for selector in parser.order], outfile ) def serialize(self, rules, outfile): try: f = open(outfile, "w") for rule in rules: f.write( "%s {\n\t%s\n}\n\n" % ( " ".join(rule[0].split("_")), "\n\t".join(rule[1]) ) ) except IOError: print "Cannot write output to: " + outfile finally: f.close() def init(): op = optparse.OptionParser( usage="Usage: %prog [options] <output file> <stylesheet1> " + "<stylesheet2> ... <stylesheetN>", description="Combine CSS rules spread across multiple " + "stylesheets into a single file" ) opts, args = op.parse_args() if len(args) < 3: if len(args) == 1: print "Error: No input files specified.\n" elif len(args) == 2: print "Error: One input file specified, nothing to combine.\n" op.print_help(); exit(-1) return [opts, args] if __name__ == '__main__': opts, args = init() outfile, stylesheets = [args[0], args[1:]] c = Consolidator() c.run(outfile, stylesheets) Test CSS file 1: body { background-color: #e7e7e7; } p { margin: 1em 0em; } File 2: body { font-size: 16px; } #header .title { font-family: Tahoma, Geneva, sans-serif; font-size: 1.9em; } #header .title a, #header .title a:hover { color: #f5f5f5; border-bottom: none; text-shadow: 2px 2px 3px rgba(0, 0, 0, 1); } Thanks in advance.

    Read the article

  • Building Paths Fluently

    - by PSteele
    If you ever need to “build” a path (i.e. “C:\folder1\subfolder”), you really should be using Path.Combine.  It makes sure the trailing directory separator is in between the two paths (and it puts the appropriate character in – DirectorySeparatorChar).  I wanted an easier way to build a path than having to constantly call Path.Combine so I created a handy little extension method that lets me build paths “fluently”: public static string PathCombine(this string path1, string path2) { return Path.Combine(path1, path2); } Now I can write code like this: var dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) .PathCombine("Folder1") .PathCombine("Folder2"); Technorati Tags: .NET,Extension Methods,Fluent

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >