w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
palm veins enhancement with OpenCV
Ok finally I've figured out by myself how to do it. Here is my code : #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #define THRESHOLD 150 #define BRIGHT 0.7 #define DARK 0.2 using namespace std; using namespace cv; int main() { // Read source image in grayscale mode Mat img = imread("roi.png", CV_LOAD_IMAGE_GRAYSCALE); // Apply ??? algorithm from http://stackoverflow.com/a/14874992/2501769 Mat enhanced, float_gray, blur, num, den; img.convertTo(float_gray, CV_32F, 1.0/255.0); cv::GaussianBlur(float_gray, blur, Size(0,0), 10); num = float_gray - blur; cv::GaussianBlur(num.mul(num), blur, Size(0,0), 20); cv::pow(blur, 0.5, den); enhanced = num / den; cv::normal

Categories : Opencv

ReCreating Thread in Visual C++
If you want to control the lifetime of the thread make sure you switch OFF m_bAutoDelete, e.g. m_pThread = AfxBeginThread( DoWork, NULL, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED ); if ( m_pThread ) { m_pThread->m_bAutoDelete = FALSE; m_pThread->ResumeThread(); }

Categories : Multithreading

Recreating "ABPeoplePicker" functionality on Mac
Perhaps Apple's CocoaPeoplePicker demo can help you. Here's the AddressBook framework reference

Categories : Xcode

Recreating activity with getting a notification
There is no "legit" way of getting the Activity the user is on. You can always do a hack : declare a static boolean sVisible member in your ActivityB class in onStart(), set that flag to true in onStop(), set that flag to false in your Service check if(ActivityB.sVisible)

Categories : Java

Azure DNS issues after destroying/recreating VM
@Nathan's comment is incorrect. When a VM is "Stopped" it is still being billed. If it is "Stopped(Deallocated)" however then the billing stops. From Azure's Pricing Details FAQ: To ensure that you are not billed, stop the VM from the management portal. You can also stop the VM through Powershell by calling ShutdowRoleOperation with 'PostShutdownAction' equal to "StoppedDeallocated". However, you will continue to be billed if you shut down a VM from inside (e.g. using power options in Windows) or through PowerShell by calling ShutdownRoleOperation with 'PostShutdownAction' equal to "Stopped". Instead of destroying the VM, you can get to the deallocated state using the azure control panel, or use Azure Cmdlets to force stop the VM. This will deallocate and you wont hav

Categories : Azure

Recreating Bing TextBox in WindowsPhone
You can define your own template with Grid control: <TextBox> <TextBox.Template> <ControlTemplate TargetType="{x:Type TextBox}"> <Grid Background="Gray" Margin="5" Width="100"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="23" /> </Grid.ColumnDefinitions> <TextBox Background="Transparent" BorderThickness="0" Text="{TemplateBinding Text}" /> <Image Grid.Column="1" Source="http://png.findicons.com/files/icons/1742/ecqlipse_2/128/microphone.png" /> </Grid> </ControlTemplate> </TextBox.Template>

Categories : C#

Entity Framework recreating new record
You are using different contexts for UserGroup.Find() and Users.Add() this is not okay - use the same context for both and it will work fine. using (InventorySystemEntities context = new InventorySystemEntities(new ConfigurationManager().ConnectionString)) { var newUser = new context.Users.CreateNew(); newUser.UserGroup = context.UserGroup.Find(1); context.Users.Add(newUser); context.SaveChanges(); }

Categories : C#

Recreating Keys (ECPublicKeyParameters) in C# with BouncyCastle
I can do this as follows: string curveName = "P-521"; X9ECParameters ecP = NistNamedCurves.GetByName(curveName); FpCurve c = (FpCurve)ecP.Curve; ECFieldElement x = new FpFieldElement(c.Q, xxx.Q.X.ToBigInteger()); ECFieldElement y = new FpFieldElement(c.Q, xxx.Q.Y.ToBigInteger()); ECPoint q = new FpPoint(c, x, y); ECPublicKeyParameters xxpk = new ECPublicKeyParameters("ECDH", q, SecObjectIdentifiers.SecP521r1); Then, I can use xxpk to verify the signature. Disclaimer: I do not claim that this is the best way to do this, just that it works!

Categories : C#

recreating whole SQL Server Database with relations
It's possible to alter only the affected tables? like this: SELECT 'alter table '+s.name+'.'+t.name+ ' alter column '+c.name+' nvarchar('+convert(varchar(11),c.max_length/2)+') go' FROM sys.tables as T inner join sys.schemas as s on T.[schema_id]=s.[schema_id] inner join sys.columns as C on T.[object_id]=C.[object_id] and c.system_type_id=239--nchar type , and before that don't forget to use the same kind of mechanism to generate an update statement to remove extra spaces.

Categories : SQL

Recreating Json file with Newtonsoft
That is because you have a List or Array of objects. The JSON you provided is just an object that contains nested objects. Basically as a rule of thumb; Anywhere you see "propertyName": { ... } you need and object in the C# code Anywhere you see "propertyName": [ ... ] you need a List<T> or T[] (array) of the enclosed type. You're going to have to write a custom serializer because integers are not valid property names in C# and a bunch of the objects in your sample json have names like "7". So to do a little bit of it for you, you need something like this; public class jsonWrapper { public Seven seven { get; set; } } public class Seven { public All all { get; set; } } public class All { public Cars cars { get; set; } } public class Cars { public Portrait Portrai

Categories : C#

Recreating service vs stopForeground(true)
As it is not doing any important thing Then it does not need to exist, so please allow it to be destroyed after unbinding. it will just take a little RAM What you think is "a little" and what the user thinks is "a little" may not be the same. Also, it will put an icon in the status bar. In addition, it will cause your process to run with foreground priority, possibly affecting the user's use of the "real" foreground app. Isn't this a good idea? No, it is not a good idea. If not, why? Besides annoying the user, it does not solve any problems. If the service was holding onto some sort of data, you need to save that data in a persistent store, such as a file or database. Your process can be terminated, by the user or by the OS, at any point, regardless of whether or no

Categories : Android

How to back stack activities without recreating them
What you are describing is the default behavior in Android. To handle Home button you don't have to code up anything. If you are in Activity C and you press Home button and later come back, you will still have Activity C the on top of the stack. If you want to navigate A->B->C you just start your app with Activity A, later call startActivity() with Activity B, and later startActivity() with Activity C. If you are in Activity C and want to go back to B, just call finish() on Activity C.

Categories : Android

Recreating bugs in cocos2d iphone
If you encapsulate the input state the player gives to the world each time step (eg. in a POD struct) then it's pretty straightforward to write that to a file. For example, suppose you have input state like: struct inputStruct { bool someButtonPressed; bool someOtherKeyPressed; float accelerometerZ; ... etc }; Then you can do something like this each time step: inputStruct currentState; currentState.someButtonPressed = ...; // set contents from live user input if ( recording ) fwrite( &currentState, sizeof(inputStruct), 1, file ); else if ( replaying ) { inputStruct tmpState; int readCount = fread( &tmpState, sizeof(inputStruct), 1, file ); if ( readCount == 1 ) currentState = tmpState; //overwrite live input } applyState( currentState

Categories : Debugging

Does recreating a table in SQL erase its contents?
recreate = drop table + create (a new) table. drop means all the data is lost. If you want to keep the data use the Alter Table http://technet.microsoft.com/en-us/library/ms190273.aspx

Categories : SQL

How to Avoid Recreating Object When Using Let with LINQ
You should not have this problem in the first place - You should fully construct your Employee instances when you initially create them, not sometime later - if an employee needs a department to be used, you should add a constructor that allows/enforces providing it: public Employee(int id, string name, Department department) { ... }

Categories : C#

Reusing Class Instance without recreating them
You can just use a HashMap to store the Objects public static HashMap<Class, Object> instances = new HashMap<Class, Object>(); public Object getInstance(Class clazz) { if (instances.constainsKey(clazz)) { return instances.get(clazz); } else { Object o = clazz.newInstance(); instances.put(clazz, o); return o } } But I don't actually understand the purpose and there seems like there's a better way to solve your problem.

Categories : Java

recreating uiimage smaller or not in bounds of the containing view
if you just change the frame of a UIImageView it should handle the scaling for you based on the content mode, you should have it set to scaleToFill probably. not sure why you are messing around with CGImage stuff (unless you are trying to recreate the image ...). or have i misinterpreted what you are trying to achieve?

Categories : Iphone

Core Data Error After Recreating Persistant Store
The "Object's persistent store is not reachable from this NSManagedObjectContext's coordinator" This message means you tried to use a managed object that was loaded from the data store that you just removed. You removed the persistent store from the coordinator and deleted the store file, but you still have at least one NSManagedObject that you loaded from that store. You can't use those objects any more, because if you do, you get this specific exception. Make sure you get rid of any existing managed objects before going nuclear on the Core Data stack in your second snippet. As for why this works in a different app, most likely that app isn't holding on to stale managed objects.

Categories : IOS

Does rebuild index do the equivalent of dropping and recreating the indexes?
i have found this sentence: However, an index reorganize does not update statistics at all because the entire table is not analyzed in one go (only pages with fragmentation are reorganized). at this article: http://www.sqlskills.com/blogs/kimberly/the-accidental-dba-day-15-of-30-statistics-maintenance/ maybe your script for rebuiding/reorganizing indexes just reorganized the index, but did not rebuild it (due to low fragmentation) and so the statistics on this index became "old". there is a good suggestion in the article: So, if you find that your index maintenance scripts are regularly reorganizing indexes then you’ll want to make sure that you also add in statistics maintenance.

Categories : C#

Recreating a triangular-ended button shape in CSS3
demo http://jsfiddle.net/Le8Hw/2/ style: #kougiland{ position:relative; width:110px; height:34px; margin:100px; color:white; text-align:center; font-size: 22px; vertical-align: middle; line-height: 30px; background-color:red; box-shadow: 0 4px 8px #ccc, 10px 5px 8px -4px #ccc, -9px 5px 8px -4px #CCC; background-image: -webkit-linear-gradient(-90deg, rgba(255, 255, 255, 0.1) 0%, rgba(244, 244, 244, 0.35) 50%, rgba(225, 225, 225, 0) 51%, rgba(246, 246, 246, 0) 100%); } #kougiland:before,#kougiland:after{ content:''; position:absolute; top: 4px; height: 26px; width: 26px; background:red; border-radius:4px; -webkit-transform: rotateZ(45deg); background-color:red; background-image: -webkit-linear-gradi

Categories : Jquery

recreating natural link click event after preventing default
As far as I understand, you're trying to intercept the link click event, send some analytics data, then recreate the click to continue with navigation. So, to do that: function NewTab(url) { var newTab = window.open(url,"_blank"); newTab.focus(); } $("a").on("click", function(e) { // more efficient var href = $(this).attr("href"); if(e.ctrlKey) { // ctrl to open in a new tab sendAnalytics("clicked a link", function() { NewTab(href); }); setTimeout(function() { location.href = href; }, 5e3); } else { sendAnalytcis("clicked a link", function() { location.href = href; }); setTimeout(function() { location.href = href; } } }); First I create

Categories : Javascript

Recreating Chrome iOS scrolling navigation bar effect in jquery/javascript
I've a similar problem to achive the same effect, maybe this could help you: Slide header up if you scroll down and vice versa. It would be great to get see some "nerdy" people who can get this to work?! To make it as you noted (the animating way), you could try something like this: http://jsfiddle.net/yckart/jzRfv/ However, I think it would be much nicer to get this working! CSS header { position: fixed; top: 0; left: 0; width: 100%; height: 128px; background: tomato; -webkit-transition: top 0.5s } JS // something simple to get the current scroll direction // false === down | true === up var scrollDir = (function (oldOffset) { return function (offset) { var dir = offset < oldOffset; oldOffset = offset; return dir; }; }(

Categories : Javascript

Django 1.3 testing without recreating database / loading fixtures for every run of the test
I was able to do this by hacking into some django code. The parts that need to be edited is, FILE: django/db/backends/sqlite3/creation.py change the code as follows: setting confirm = 'yes' in line 55 commenting out all occurrences of os.remove(test_database_name) FILE: django/db/backends/creation.py change the code as follows comment 359 to 376 (the syncdb & flush part in create_test_db function. almost everything in _create_test_db. (almost everything == code part which does the undesired stuff which we are trying to eliminate) almost everything in _destroy_test_db. almost everything in destroy_test_db. Hope that helps!

Categories : Django

Recreating the iPad home screen icon rotation / orientation effect
iOS 6 offers a class called UICollectionView that handles the creation of these grids for you. The API is fairly similar to that of UITableView and allows you lots of control for customization. Check out the UICollectionView class reference, as well as this introductory tutorial.

Categories : Objective C

Best practice in recreating CoreData entities with actual data retrieved from the server
This is trivial. You simply keep an attribute with the time stamp of the last update and just request the changed and new entities from your server. Then you insert, update or delete as appropriate.

Categories : IOS

DirectShowNet - Error when recreating graph for webcam after unplug/replug back in
So, basically, I just woke up one morning, got to work, and stared at the code and went, "Wait, I know why this isn't working...". It is a threading issue. The initial graphs I was creating were on a different thread than the graphs I was trying to create later. That's why it only happens when I recreate the graphs. I was also having a problem with IVideoWindow's put_Owner method when the device is plugged in after the application has already started. In this case, the device wasn't unplugged while executing, and put_Owner would freeze/deadlock trying to that method. Overall, I have a thread that is detecting when a device is unplugged/plugged in using DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice). So, when I go to create these graphs, they are not on the main UI thread where

Categories : C#

Chrome: window.print() print dialogue opens only after page reload (javascript)
I am most certain you are experiencing this issue because you have a video element on your page - most probably an MP4. If you disable this video / or have an OGV video instead, the printing should work fine. It is a bug in chrome itself due to limitations of Chrome's video implementation. It is also important to note that if the user prints manually with ctrl-p / cmd-p, print functions correctly http://code.google.com/p/chromium/issues/detail?id=141633 Hope this helps :)

Categories : Javascript

Python: Why "return" won´t print out all list elements in a simple for loop and "print" will do it?
When you use a return statement, the function ends. You are returning just the first value, the loop does not continue nor can you return elements one after another this way. print just writes that value to your terminal and does not end the function. The loop continues. Build a list, then return that: def union(a,b): a.append(b) result = [] for item in a: result.append(a) return result or just return a concatenation: def union(a, b): return a + b

Categories : Python

How can I prevent Internet Explorer from repeat displaying the same background image in every page of a print out using a print CSS stylesheet?
I ran into the same problem today. One solution is a structure like this: <body> <div id="background" style="position: relative;"> <img src="bkgnd.png" style="position: absolute; z-index: -1;"> <div class="container" ...> ... </div> </div> </body> The basic idea is to take the image out of the flow but position it relative to its containing <div>. The z-index pushes it behind other elements. So this can be used as any kind of column header. One upside to this is that the background image will print even if the "background images" option isn't set in the print dialog. I'd like to see a proper solution as well though. Edit 2013/07/23: It looks like the CSS3 property will be box-decoration-break. This isn't going to help

Categories : CSS

Deployed Qt5 Application Doesn't Print or Show Print Dialog
This was another classic Windows/Qt5 deployment problem with a combination of missing plugins and plugins placed in incorrect places. By using the environmental variable QT_DEBUG_PLUGIN and adding CONFIG += CONSOLE to my PRO file I was able to see that on my development machine the application was loading qminimal.dll which I was not shipping. The application root which I have defined as {myAppPath} is the root directory for plugins. Therefore the correct file structure is: {myAppPath}MyApp[MyApp.exe, Qt5PrintSupport.dll, ...] {myAppPath}platforms[qwindows.dll,qminimal.dll] {myAppPath}printsupport* {myAppPath}imageformats* {myAppPath}earer* Thanks peppe for the lead.

Categories : Windows

use windows print instead of browser print directly from link/button
It could be a solution, if the printable view to be shown as pdf, and the adobe reader has the ability to print it normally. I don't see any other solution how could you invoke the OS print... Probably with IE, and asp.net you can, but i don't think this would satisfy you :) Kind regards, hotzu

Categories : Javascript

Recreating image from opaque pixels in another image
You have created a double loop over all your pixels: indexOfObjectsPassingTest: continues if you dont set *stop to YES after you have found your pixel. Maybe that's what's making it so slow? My approach would be to add a shadow in one direction and draw and then add a shadow in the other direction and draw. CGFloat width = image.size.width; CGFloat height = image.size.height; UIGraphicsBeginImageContext(CGSizeMake(width, height)); CGContextRef context = UIGraphicsGetCurrentContext(); // shadow in one direction CGSize offset = CGSizeMake(2,2); CGFloat blur = 0; CGColorRef color = [UIColor blackColor].CGColor; CGContextSetShadowWithColor(context, offset, blur, color); CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.CGImage); // shadow in the other direction CGSize

Categories : IOS

Print RED BLUE GREEN in order using System.out.print
public class TestSynMain { private final static AbstractQueuedSynchronizer cb = new TestSynchronizer(6); public static void main(String[] args) { final class ColouredRunnable implements Runnable { private String color; public ColouredRunnable(String color) { this.color = color; } @Override public void run() { while (true) { try { boolean result = false; do{ result = cb.tryAcquireNanos(Integer.parseInt(Thread.currentThread().getName()), TimeUnit.MILLISECONDS.toNanos(1000)); }while(!result); for (int i = 0; i < color.length(); i++)

Categories : Java

How does the WinRT Chrome app print without triggering the OS's "Print" dialog?
I don't think you can. The one browser app that enjoys the privilege of being your WinRT browser also enjoys special privileges not granted to other WinRT apps. For example, you can bet that Chrome is neither a XAML app nor an HTML/JS app. Yet all WinRT apps (except the one browser app) must be one of these two. Skipping the print dialog is probably a matter a simply calling the underlying Win32 print APIs -- something browsers are allowed to do but no other WinRT app is.

Categories : Google Chrome

How to print PDF file already opened in QLPreviewController using print button?
Why this Error occurs because you have set the URL wrong. You are setting url like that; /Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf Where as UIDocumentationController task URL as: file://localhost/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf This minor mistake will made you mad ;)

Categories : IOS

print to print as comma separated values on the same line
One cause could be that the first piece of code is executed with Python 2 and the second one with Python 3. If that's not it, then try end=", ". My guess is that the second single quote isn't actually the quote that you want (i.e. it's backtick instead of single quote or something like that). Or maybe there is an illegal character in there that you can't see in your editor.

Categories : Python

Python, logging print statements while having them print to stdout
You can add this to your script: import sys sys.stdout = open('logfile', 'w') This will make the print statements write to logfile. If you want the option of printing to stdout and a file, you can try this: class Tee(object): def __init__(self, *files): self.files = files def write(self, obj): for f in self.files: f.write(obj) f = open('logfile', 'w') backup = sys.stdout sys.stdout = Tee(sys.stdout, f) print "hello world" # this should appear in stdout and in file To revert to just printing to console, just restore the "backup" sys.stdout = backup

Categories : Python

How to print different items depending on a random print in Python?
You have done the hard part. Now you just need to map the skills to each category. For instance, using a dictionary: skills = {'Mage': range(7), 'Warrior': range(7,14), 'Thief': range(14,21)} choice = random.choice(skilltree) print skills[choice] This will print the list of skills you associated with the chosen skilltree. I used range just to illustrate, you could have a list of strings with the skills.

Categories : Python

How to print some specific part of a page via window.print()
One posible solution, perhaps not the best option: 1. Open a new window with JS 2. Copy the whole table into the new window (with jQuery for example) 3. Print the new window 4. Close the window Sure it has a blink effect but It will work.

Categories : PHP

window.print() print all div content without scrollbar
This is code to print div content using javascript. <script language="javascript" type="text/javascript"> function printDiv(divID) { //Get the HTML of div var divElements = document.getElementById(divID).innerHTML; //Get the HTML of whole page var oldPage = document.body.innerHTML; //Reset the page's HTML with div's HTML only document.body.innerHTML = "<html><head><title></title></head><body>" + divElements + "</body>"; //Print Page window.print(); //Restore orignal HTML document.body.innerHTML = oldPage; } </script> <div id="printme" style="width: 100%; background-color: Blue; height: 200px"> Print me I am in

Categories : Javascript



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