w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
"Merging" a stream of streams to produce a stream of the latest values of each
This solution will work for one-item streams but unfortunately accumulates every item in an inner stream until it finishes. public static IObservable<IEnumerable<T>> MergeLatest<T>(this IObservable<IObservable<T>> source) { return Observable.Create<IEnumerable<T>>(obs => { var collection = new PerishableCollection<T>(); return source.Subscribe(duration => { var lifetime = new DisposableLifetime(); // essentially a CancellationToken duration .Subscribe( x => // on initial item { collection.Add(x, lifetime.Lifetime); obs.OnNext(collection.CurrentItems().Select(p => p.Value))

Categories : C#

Why does this method without fail produce a "malloc_error_break" every run?
You are creating a lot of autoreleased objects without draining the autorelease pool. Try using @autoreleasepool { // Code that creates autoreleased objects. } somewhere around the call of elementWithPath:. See also the documentation.

Categories : Objective C

Why does PHP fail to produce an image when loading an image that has been taken from facebook?
Try automatically "re-saving" the image after the upload with imagejpeg(imagecreatefromjpeg($filename),$filename,9); This should re-create any malformed or unrecognised headers from the original Facebook image.

Categories : PHP

Sevenzip extractFile(String file, Stream stream) method stream parameter. c#
Setup a FileStream that SevenZip can write out to: DirectoryInfo directoryInfo = new DirectoryInfo(ApplicationPath); FileInfo[] zipFile = directoryInfo.GetFiles("*.7z"); using (SevenZip.SevenZipExtractor zipExtractor = new SevenZip.SevenZipExtractor(zipFile[0].FullName)) { using (FileStream fs = new FileStream("", FileMode.Create)) //replace empty string with desired destination { zipExtractor.ExtractFile("ConfigurationStore.xml", fs); } }

Categories : C#

Fail to detect and fail to prompt error for same data in the SQL server and textbox
In the row if (tbpid.Equals(dr["policeid"].ToString())) you forgot .Text: if (tbpid.Text.Equals(dr["policeid"].ToString())) the same in checking for NRIC And regarding However, when i type a different PoliceID but the same NRIC, the error msg did not appear but the insertion of the data succeeded. I suppose your table hase uniq constraint on policeid column, but not on nric

Categories : C#

How can I make a Grunt task fail if one of its sub tasks fail?
The default behavior in Grunt is to not run subsequent tasks if one fails. So you must be using the force option somewhere. You are either: 1 - passing --force on the command line 2 - calling grunt.option( 'force', true ); somewhere 3 - have the jshint force option set on your jshint task Note that in the case of calling grunt.option( 'force', true );, it remains true for the remainder of the batch, not just inside the task where it was set. see this question and this question for details.

Categories : Javascript

How to update an XML document by stream reading a file and simultaneously stream writing output
Use SAX parser instead of DOM. You can also use the StAX APIs (part of JDK package javax.xml.stream ). Further reading- http://docs.oracle.com/javase/tutorial/jaxp/sax/parsing.html http://download-llnw.oracle.com/javase/6/docs/api/index.html?javax/xml/stream/package-summary.html

Categories : Java

Dart is there any way to invoke onDone callback from stream.listen() where the stream is from StreamController
You need to call StreamController.close() new Stream.fromIterable(data) basically creates a StreamController, adds the elements of the iterable one at a time, and closes the controller when the iteration is complete. In your second code block you're doing this manually, but just not closing the controller. Here's the relevant docs: http://api.dartlang.org/docs/releases/latest/dart_async/StreamController.html#close

Categories : Dart

Stream video from iPhone to web server - compress and stream step
Take a look at http://www.gdcl.co.uk/2013/02/20/iOS-Video-Encoding.html. This sample uses an AVAssetWriter to encode the video from the camera to H264 and then uses RTSP/RTP to stream the data to a player.

Categories : Iphone

How to chain write stream, immediately with a read stream in Node.js 0.10?
request(url).pipe(fs.createWriteStream(filename)).pipe(writestream); is the same as this: var fileStream = fs.createWriteStream(filename); request(url).pipe(fileStream); fileStream.pipe(writestream); So the issue is that you are attempting to .pipe one WriteStream into another WriteStream.

Categories : Node Js

scala iterator and stream example. stream fails on reuse
It fails because the sentences Iterator has been expended. One is not suppose to call an Iterator after a method on it has been called except for the next and hasNext methods. A simple example shows this: scala> val it = Iterator(1,2,3) it: Iterator[Int] = non-empty iterator scala> it.foreach(println(_)) 1 2 3 scala> it.foreach(println(_)) scala> In your case sentences has been expended on the first call and is empty on the second one giving a size of 0. Calling toStream on it does not change this. You get back an empty Stream. If you want to reuse sentences assign it to a list with val l = sentences.toList before calling count.

Categories : Scala

NodeJS: What's the difference between a Duplex stream and a Transform stream?
The difference is just syntactic sugar. Transform streams are full duplex streams but rather than implementing _write and _read methods, you are asked to implement just the _transform method. You can read more about streams on the excellent substack's streams guide or from Isaacs's readable-stream repo.

Categories : Node Js

Can a writeable stream be piped to either a readable or wirtable stream
Ad 1: Yes, a must be a readable stream, and b must be a writable one. But, streams are not neccessarily either / or, they also can be both: Readable and writeable at the same time. So, b and c are both, hence you can pipe into them, but also pipe from them. Technically they are so-called duplex streams. Ad 2: Should be answered by now ;-). Ad 3: Yes, you should definitely check out the stream-handbook by @substack (aka James Halliday). For buffers, see How to use buffers in Node.js by NodeJitsu.

Categories : Node Js

Balancing slow I/O in a fast stream read stream
I just ran into this problem last night, and in my hackathon induced sleep deprived state, here is how I solved it: I would increment a counter whenever I sent a job out to be processed, and decremented the counter when the operation completed. To keep the outbound traffic from overwhelming the other service, I would pause the stream when there was a certain number of pending outbound requests. The code is very similar to the following. var instream = fs.createReadStream('./combined.csv'); var outstream = new stream; var inProcess = 0; var paused = false; var rl = readline.createInterface(instream, outstream); rl.on('line', function(line) { inProcess++; if(inProcess > 100) { console.log('pausing input to clear queue'); rl.pause(); paused = true; }

Categories : Node Js

Copy all but the last 16 bytes of a stream? Early detection of end-of-stream?
Read between 1 and n bytes from the input stream.1 Append the bytes to a circular buffer.2 Write the first max(0, b - 16) bytes from the circular buffer to the output stream, where b is the number of bytes in the circular buffer. Remove the bytes that you just have written from the circular buffer. Go to step 1. 1This is what the Read method does – if you call int n = Read(buffer, 0, 500); it will read between 1 and 500 bytes into buffer and return the number of bytes read. If Read returns 0, you have reached the end of the stream. 2For maximum performance, you can read the bytes directly from the input stream into the circular buffer. This is a bit tricky, because you have to deal with the wraparound within the array underlying the buffer.

Categories : C#

Is there a generator that will turn a stream of text into a stream of lines?
After reading your edit, maybe you could modify the stream object which returns arbitrary amounts of text? For example, in the stream.next() method, there is some way the stream generates a string and yields it when .next() is called. Could you do something like: def next(self): if ' ' in self.remaining: terms = self.remaining.split(' ') to_yield, self.remaining = terms[0], ''.join(terms[1:]) yield to_yield else: to_yield = self.remaining + self.generate_arbitrary_string() while ' ' not in to_yield: to_yield += self.generate_arbitrary_string() to_yield, self.remaining = terms[0], ''.join(terms[1:]) yield to_yield This pseudocode assumes that the stream object generates some arbitrary string with generate

Categories : Python

Stream processing errors with stream with embedded nulls
What you pass a C style string (char pointer) to the std::istringstream constructor it actually instantiates a std::string and passes that instead. This happens due to an implicit conversion. The conversion constructor of std::string interprets a null byte character in C style strings as an end of string terminator causing all characters after it to be ignored. To avoid this you can explicitly construct a std::string specifying the size of the data and pass it to std::istringstream char bin[] = {0x30, 0xb, 0x0, 0x6, 0x6, 0x2b, 0xc, 0x89, 0x36, 0x84, 0x13, 0xa, 0x1}; std::istringstream strm(std::string(bin, sizeof(bin) / sizeof(bin[0]))); Note: I don't know exactly what you are trying to accomplish but I recommend using std::vector instead of a raw character buffer if possible.

Categories : C++

I want to stream video from my webserver, but I only want it to stream when there is a viewer
Try Page Visibility API. Supported Browsers : http://caniuse.com/#feat=pagevisibility

Categories : Javascript

RX: How to concat a Snapshot stream and an Update stream?
Whether you use a ReplaySubject or the Replay function really makes no difference. Replay uses a ReplaySubject under the hood. I'll also note that you are leaking subscriptions like mad, which can cause a resource leak. Also, you put no limit on the size of the replay buffer. If you watch the observable all day long, then that replay buffer will keep growing and growing. You should put a limit on it to prevent that. Here is an updated version of GetStream. In this version I take the simplistic approach of just limitting the Replay to the most recent 1 minute of data. This assumes that GetData will always complete and the observer will observe the results within that 1 minute. Your mileage may vary and you can probably improve upon this scheme. But at least this way when you have

Categories : C#

Network stream stuck on stream.Read(byte[] byte, int offset, int size)
Because it's a stream, and can be partial received. Are you sure you are always receiving packages with te size of 2048 bytes? int i = 0; int bytesNeeded = 200; int bytesReceived = 0; do { //read byte from client int bytesRead = stream.Read(receivedBytesRaw, bytesReceived, bytesNeeded-bytesReceived); bytesReceived += bytesRead; // merge byte array to another byte array } while (bytesReceived < bytesNeeded); I think you need a frame protocol, try create a protocol like, writing the size of the data that follows. example: (psuedo) void SendData(byte[] data) { // get the 4 bytes of a int value. byte[] dataLength = BitConverter.GetBytes(data.Lenght); // write the length to the stream. stream.Write(dataLengt

Categories : C#

DevExpress ASP.NET - Want to use Razor without MVC
Depending on what you are specifically looking to do, you should check out RazorEngine - it lets you render HTML from Razor without alot of the scaffolding that you will have to do in order to use Razor like MVC uses Razor...

Categories : Asp Net Mvc

Odd behaviour: copying more bufferSize with .NET Stream.CopyTo(Stream destination, int bufferSize)
I misunderstood the meaning of bufferSize in Stream.CopyTo(Stream destination, int bufferSize). I thought it was the total amount of bytes to be copied, not simply the buffer to be used while copying. There is no feature in the Stream object to copy only a specific number of bytes. I fixed the problem by replacing this.captureStream.CopyTo(captureSession.captureStream, chunkLength); with writer.Write(reader.ReadBytes(chunkLength));

Categories : C#

DevExpress Grid not display
I don't think you need the DisplayMemberBinding parameters. ItemsSource takes care of the binding for the entire grid and for each column FieldName selects the field from the database record or ObservableCollection item or whatever.

Categories : Dotnet

DevExpress ChartControl with scrollbar
I hope I understood your question. You can use the XtraScrollableControl. Simply place it on your form and then place the charts into the control. You should make your charts the size you want them to be and the scroller does the rest :)

Categories : C#

Devexpress GridControl row backcolor
Try GridView_RowStyle event to change a row's background color http://documentation.devexpress.com/#windowsforms/DevExpressXtraGridViewsGridGridView_RowStyletopic gridView1.RowStyle += gridView1_RowStyle; private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { GridView view = sender as GridView; if(e.RowHandle >= 0) { bool isRed = Convert.ToBoolean(view.GetRowCellDisplayText(e.RowHandle, view.Columns["Category"])); if(isRed) { e.Appearance.BackColor = Color.Red; } } }

Categories : C#

Only LegacyIAccessible pattern available in DevExpress
In the worst case, you can always use SendInput to generate mouse clicks. You can use the BoundingRectangle property to get the bounds, and then use the midpoint for a clickable point. (I'm assuming that the ClickablePoint property isn't set either.)

Categories : C#

How to add buttons to DevExpress RibbonControl?
What you're willing to do is not add a button, but a page. Take a look in this link below: http://documentation.devexpress.com/#wpf/CustomDocument7954 EDIT due to comment That "area" you want to add buttons is called Page Header in a Ribbon. This link below shows how to but them there: http://documentation.devexpress.com/#wpf/CustomDocument8186 I'm not sure about what sizing / positioning capabilities you will have though (considering the exact layout you intended in your image).

Categories : C#

Devexpress pie chart with zero values
you can do something like this // Create an empty chart. ChartControl pieChart = new ChartControl(); // Create a pie series. Series series1 = new Series("A Pie Series", ViewType.Pie); // Populate the series with points. series1.Points.Add(new SeriesPoint("No Results found", 100)); // Add the series to the chart. pieChart.Series.Add(series1);

Categories : C#

DevExpress XtraReport in ASP.NET MVC 4 application
There are several ways to do this. The easiest, if you just want to create a report based on a table, is to use the built in DevExpress GridView DataExport function, illustrated here: https://demos.devexpress.com/MVCxGridViewDemos/Exporting/Export If, however, you want to use the XtraReports functionality, you could follow this example: https://demos.devexpress.com/MVCxReportDemos/ReportTypes/TableReport I hope this helps!

Categories : C#

Extjs with Devexpress ChartJS
Use the html property of the panel to render your div in the panel's body. Create your chart in the afterrender event of the panel, so that the div is available. Finally, use the resize event to resize your div when the panel is resized. See this other answer. The charting lib is different but the principles are exactly the same. Edit I can't get to make the chart resize in height. Since I know nothing about the lib, I just refered to this support question... But I think it is the normal behaviour for the type of chart you're using. Anyway, here's my code (also, in this fiddle): Ext.define('DxChartPanel', { extend: 'Ext.Panel' ,resizable: true ,html: '<div class="chartContainer" style="width: 100%; height: 100%"></div>' ,initComponent: function() {

Categories : Jquery

change column to row in gridcontrol wpf devexpress
Devex has a vertical grid that does exactly that but sadly it is not available for WPF but only for WinForms. This link shows an example of how to show a grid that will resemble the WinForms VerticalGrid control. This link is to a question on the Devex site that sounds similar to yours. Maybe you'll find an answer there. Hope that helps :)

Categories : Wpf

Change colors in devexpress charts
you can set the theme and palette properties of the chart control. follow the links below to devexpress documentation. although the examples refers to winform application they are still avaliable in asp.net mvc controls. http://documentation.devexpress.com/#WindowsForms/CustomDocument7433 http://documentation.devexpress.com/#WindowsForms/CustomDocument5538 // Define the chart's appearance and palette. barChart.AppearanceName = "Dark"; barChart.PaletteName = "Opulent";

Categories : Asp Net Mvc

Devexpress GridView.PageIndex value is wrong
This is how I fixed the problem, but still don't know why grid.PageIndex contained random values in the code above. private void SetGridDataSource() { grid.DataSource = GetListOfSomeType(); grid.DataBind(); grid.PageIndexChanged += new EventHandler(grid_PageIndexChanged); } void grid_PageIndexChanged(object sender, EventArgs e) { grid.Settings.ShowFooter = (grid.PageIndex == grid.PageCount - 1); }

Categories : Asp Net

Winforms Devexpress application deployment
In your DevExpress installation Folder is a Subfolder BinFramework. You have do deploy the dll you use in your Application with it. Edit: you should also consider the comment of Adriano

Categories : C#

devexpress callback results syntax
What you are trying to achieve can be done using the JSProperties on callback and the OnEndCallback client side event of the ASPxGridview. This aspx tag can be placed exactly after the </Columns> closing tag of the ASPxGridview. <ClientSideEvents EndCallback="function(s,e) { var errText = s.cpError; if (errText != "") { alert(errText); } }" /> On the server side you set the JSProperties like this gridOfApp.JSProperties["cpError"] = "The error was major!"; Important. Bear in mind that your JSProperties MUST ALWAYS start with the cp prefix.

Categories : Javascript

Devexpress MVC , passing object to CallbackRouteValues
ReportViewer uses the CallbackRouteValues value to create a callback URL. Hence, the model instance will be converted to a string. ASP.NET MVC engine cannot parse a string and create a class instance unless it is a simple type. To make it possible, create a TypeConverter descendant, override its CanConvertFrom and ConvertFrom methods and implement conversion from the String type to the model type. Assign this converter to the model class via the TypeConverterAttribute attribute. UrlHelper class (it is used by the ReportVirwer to create a callback URL) do not use the type converter, though. To handle the convertation from the model to the String type, implement the IConvertible interface in the model class.

Categories : Asp Net Mvc

How to run Devexpress report designer at runtime ?
It's very easy to do , I have wrote the code below , that will help to do what you want using System; using System.Windows.Forms; using DevExpress.XtraReports.UI; // ... private void Form1_Load(object sender, EventArgs e) { XtraReport1 report = new XtraReport1(); ReportDesignTool dt = new ReportDesignTool(report); // Invoke the standard End-User Designer form. dt.ShowDesigner(); // Invoke the standard End-User Designer form modally. dt.ShowDesignerDialog(); // Invoke the Ribbon End-User Designer form. dt.ShowRibbonDesigner(); // Invoke the Ribbon End-User Designer form modally. dt.ShowRibbonDesignerDialog(); }

Categories : C#

How deselect row in grid of devexpress - winforms
When multiple selection is off, the grid does not allow unfocusing a row and always contains a focused row. See this issue for some additional information. The GetSelectedRows and ClearSelection documentation clearly states that these do nothing if multi-selection is disabled. There are a couple of sample projects in the support center regarding row selection: http://www.devexpress.com/Support/Center/Example/Details/E13 http://www.devexpress.com/Support/Center/Example/Details/E135 The best place to ask for support for DevExpress related questions is their Support Center. If you describe what you are trying to achieve, they always respond quickly and helpfully.

Categories : C#

Changing Row Colours on DevExpress GridView
For changing the row colour in runtime handle the RowStyle event: public Color color1; public Color color2; public int rowhandle; private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { try { if (e.RowHandle == rowhandle) { if (color1 != null && color2 != null) { e.Appearance.BackColor = color1; e.Appearance.BackColor2 = color2; } } } catch { } } private void button1_Click(object sender, EventArgs e) { color1 = Color.BurlyWood; color2 = Color.DarkOrchid; rowhandle = gridView1.FocusedRowHandle; gridView1

Categories : C#

How can I set ConvertEmptyStringToNull in DevExpress MVC GridView control?
The below works Ok for my purposes since I at least do not have to individually set every such property but strongly feel user data should NOT be changed by default. I made the suggestion to the DevExpress folks that there should be easier ways to override this behavior at field, grid and global levels. Here is my interim solution: settings.DataBound = (sender, e) => { // turn off brain dead conversion of user data empty strings to null var lGrid = sender as MVCxGridView; foreach (var lCol in lGrid.Columns) { if (lCol is GridViewDataColumn) { GridViewDataColumn lDataCol = lCol as GridViewDataColumn; TextBoxProperties tb = lDataCol.PropertiesEdit as TextBoxProperties; if (tb !

Categories : Asp Net Mvc



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.