w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
How to show user.name associated with timesheets?
If you have an association with the user model then you can get the user model by calling timesheet.user In this case of this problem <ul class="timesheets"> <% @timesheets.each do |timesheet| %> <NOBR> <li> <%= timesheet.user.name %> <%= timesheet.starting.strftime("[ %^a %^b %e, %Y - %l:%M %p ] - ") %><%= timesheet.ending.strftime("[ %^a %^b %e, %Y - %l:%M %p ]") %> <%= (timesheet.ending - timesheet.starting)/3600 %> Hours <% if current_user.admin? %> | <% if timesheet.approved? %> <%= link_to "Un-Approve", { action: :unapprove, id: timesheet.id }, method: :put %> <% else %> <%= link_to "Approv

Categories : Ruby On Rails

Sample application with multitenant database
Take a look at the Enzo SQL Shard open-source framework which comes with a sample application. This framework comes with different sharding strategies; the one you may want to implement is the Compressed Shard. There is also documentation available showing you how this works.

Categories : SQL

mapping URLs in Spring PetClinic sample application
I'm not sure which version of the OwnerController you're using. So it may help if you post the whole class (or at least the signature of the class, e.g. any annotations at the class level). If you're using a version that doesn't have a class level @RequestMapping (like this one), then your method level mapping should be @RequestMapping(value = "/owners/catowners", method = RequestMethod.GET) since your url (post petclinic app context) is /owners/catowners

Categories : Java

Google tasks api java for sample desktop application
Not at all! Client libraries for the Tasks API, just like all Google APIs, is available on a number of different platforms. In addition, you can always make the REST calls yourself on any unsupported platform. This is where you can download jars for any Java client application. You'll find what you need in order to write an Android application, App Engine application, or a generic Java application all bundled inside. Here is all the documentaion on the Tasks API. Pretty much any questions you have about the API in general should be answered there, as well as a "Getting Started" walkthrough and other helpful guides. Finally, here is a list of all client library platforms that Google generates for the Tasks API.

Categories : Misc

Build "ImageTargets" shared library-Vuforia sample application
The problem has solved!!I found the path.During the installation of Vuforia a new folder had been created in C:Development...... bla bla bla... In fact I reinstalled everything according to Vuforia site and for the time being everything works great... thank you very much Al G...

Categories : Android

An sample application on calling the webservices from android, which is returnig the error, "Unfortunately,MyTest has stopped".
Use like this: XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="@+id/web_service" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="112dp" android:layout_marginTop="146dp" android:text="Web Service" /> <TextView android:id="@+id/fetch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Tex

Categories : Android

tomcat 7 server will not start after deleting and reinstalling Spring PetClinic sample application
This sometimes happens with Eclipse's Maven plugin. For some reason or other, it messes up its dependency mappings to the correct folders (ie. the library paths) when creating the classpath entry to run your application. In that case, the classpath is not correctly set and you get ClassNotFoundExceptions. You can usually fix this by forcing Maven to recalculate/set its paths by either restarting Eclipse or deleting the .m2 folder that holds all the downloaded jars. This folder is usually under your User folder in Windows, C:/Users/your.name.

Categories : Java

Android- Change the Sample size or bits per sample for audio playback
No, you cannot control the sample size or bitrate with MediaPlayer. If you want to do this you will need to decode the audio yourself using a library like FFmpeg and then use AudioTrack for playback.

Categories : Android

Need a small sample application based on the technology stack (Durandal, Knockout, Require, Mongo and Breeze)
Take a look at the samples here. You will probably not find the exact technology stack that you are using but the samples include examples of knockout, require, durandel, and mongoDB.

Categories : Mongodb

Chromecast app starting from sample TicTacToe - failed to start application: request failed
In file README_ECLIPSE.txt it says: In GameActivity at line 91, the code makes a call to the app name "TicTacToe". This is a whitelisted app name at which the TicTacToe receiver is located, so you can simply build and run the app without worrying about whitelisting your own receiver. So please do not change anything in the sample code (to replace with your AppId), just build and run to see if it works for you. If you can't make that work, please check the answer here: Unable to debug Whitelisted device / ApplicationSession failing to start

Categories : Android

Website access per client and each client having multiple users Sample Application
of course you can have every sub-application it's own ASP.NET membership. or if you want the work out-of-the box solution for cms, you can try dotnetnuke community version and set the sub-website it's own settings

Categories : C#

Image recognition sample size, Is larger sample size necessary for objects that are exactly equivalent pictures?
OCR not only has to distinguish between different letters, but also contend with issues like small rotations, translations or deformations. A useful neural net (a common model for OCR) will need to be trained against labeled data that includes these transforms. You could perhaps get away with starting with one image per letter, and programmatically rotating and translating it in increments to produce many labeled training examples. For that matter, for the "original" examples surely you can render individual letters with your desired font and save them to a file, rather than using literal screen capture.

Categories : Machine Learning

sample example for JCS
I did two changes and the expected outcome of above sample code was achieved. console -> "Valid cached Data: dev" What I did Adding an additional line to cache.ccf under default cache region - jcs.default.cacheattributes.DiskUsagePatternName=UPDATE Adding a sleep at the end of class 1: main method Explanation DiskUsagePattern defaults to SWAP which means the cache elements are written to the disk when MaxMemoryIdleTimeSeconds of the element has reached, default seems to be 60 * 120 seconds. When DiskUsagePattern is UPDATE, the elements are written to the disk when they are added to the cache. Well, elements are not written to the cache synchronously, instead added to a queue to be written immediately and return. So, if someone is looking for an immediate and reliable update on t

Categories : Java

How to run the google map sample v2?
This Worked for me 1) Install Google map APIs. This can be done in Eclispe Windows/Android SDK and AVD Manager -> Available Packages -> Third Party Add-ons -> Google Inc. -> Google APIs by Google Inc., Android API X 2) From command line create new AVD. This can be done by listing targets (android list targets), then android create avd -n new_avd_api_233 -t "Google Inc.:Google APIs:X" 3) Then create AVD in Eclipse Windows/Android SDK and AVD Manager -> New... -> (Name: new_avd_X, Target: Google APIs (Google Inc.) - API Level X) 4) Create Android Project in Eclipse File/New/Android Project and select Google APIs Build Target. 5) add between tags. 5) Run Project as Android Application.

Categories : Android

high chart sample
The bullet concept will work for this, though it will take some work to get styling like that. There are plenty of useful options for styling such a chart though without relying on the physical gauge metaphor. A quick variation on the bullet chart approach that puts them into a single chart and removes the banding: http://jsfiddle.net/jlbriggs/kwtZr/41/ It relies on a custom extension to produce the 'line' marker type: Highcharts.Renderer.prototype.symbols.line = ... {{ edit in response to comments below: updated example with some additional formatting options and clean up: http://jsfiddle.net/jlbriggs/kwtZr/55/ be wary of using multiple colors unless the colors truly mean something. Using additional color to highlight items that require attention is a good use of color. Using

Categories : Highcharts

Why does the sample code use getTag();
I think holder = (ViewHolder) convertView.getTag() shoud be holder = (ViewHolder) convertView, since ViewHolder is not a View how could the cast works ? You set the ViewHolder object as tag for the convertView, and retrieve it everytime the getView is called, in order to avoid to look for your View components (your ImageView and CheckBox). This way you can avoid to call findViewById() during the scrolling of ListView.

Categories : Android

sample Evaluation function
A case statement is a bit like a switch statement from other languages. The expression between the case and the of is matched against each pattern in order until one matches. The last case _ matches everything, a bit like a default case in a Java switch statement. e.g. -- simple data type which just wraps a value data Foo a = Foo a n = Foo 1 describe :: Foo Int -> String describe n = case n of Foo 0 -> "Zero" Foo 1 -> "One" Foo 2 -> "Two" _ -> "Every other Foo Int!" The example from your code combines two expressions in a tuple so they can be pattern matched at the same time: case (eval e1, eval e2) of (IntV i1, IntV i2) -> IntV $ i1 + i2 _ -> error "Add: Int expected" It'

Categories : Haskell

DHL Sample Tracking numbers
I just found this link http://xmlpitest-ea.dhl.com/serviceval/jsps/main/Main_menu.jsp This link has samples of everything you need to track dhl shipments. Hope this can help someone else out there.

Categories : Web Services

Sample two pandas dataframes the same way
If you make rows a boolean array of length len(df), then you can get the True rows with df[rows] and get the False rows with df[~rows]: import pandas as pd import numpy as np import random np.random.seed(2013) df_source = pd.DataFrame( np.random.randn(5, 2), index=range(0, 10, 2), columns=list('AB')) rows = np.random.randint(2, size=len(df_source)).astype('bool') df_source_train = df_source[rows] df_source_test = df_source[~rows] print(rows) # [ True True False True False] # if for some reason you need the index values of where `rows` is True print(np.where(rows)) # (array([0, 1, 3]),) print(df_source) # A B # 0 0.279545 0.107474 # 2 0.651458 -1.516999 # 4 -1.320541 0.679631 # 6 0.833612 0.492572 # 8 1.555721 1.741279 print(df_source_train) #

Categories : Python

SQL query - percentage of sub sample
select t1.ID, t1. GroupID, (t1.Profit * 1.0) / t2.grp_profit as percentage_profit from table t1 inner join ( select GroupID, sum(Profit) as grp_profit from table group by GroupID ) t2 on t1.groupid = t2.groupid

Categories : SQL

Deploying sample GWT app to Tomcat
The problem is with this step: I then took the war file, zipped it up and renamed it gwtproject.war Do not make the war file zip and rename to war, because that is a war file in a non war file :) war file has manifest, zip not. Just take the original war file ( without zipping) and deploy that one.

Categories : Java

Google API Sample not Loading
You need to import the Google jsapi before you attempt to load the visualisation package. Make sure the following line appears early in your document: <script type="text/javascript" src="https://www.google.com/jsapi"></script> If you copy paste the entire contents of the online example it works properly.

Categories : Javascript

iOS Pin It SDK with no documentation and sample code
A quick glance at the header reveals that you should be passing in NSURL instances as the values for the imageURL and sourceURL, so once you do that it will no longer complain about trying to invoke absoluteString on an NSString. The readme docs are probably not up to date with the API. This happens. A lot. You probably need to do: [pinterest createPinWithImageURL:[NSURL URLWithString:@"http://www.warrenphotographic.co.uk/photography/bigs/10122-Silver-and-red-kittens-white-background.jpg"] sourceURL:[NSURL URLWithString:@"http://placekitten.com"] description:@"Pinning from Pin It Demo"];

Categories : IOS

Using sample() when x is of varying length
Once you have matrix vs. dataframe or whatever it is straightened out, here's a workaround I've used: vec.len<-length(my_vector) if (vec.len <2 ) my_vector<-rep(my_vector,2) sample(my_vector,1)

Categories : R

Python Sample App for BigQuery
It looks like the sample query used (from here) is: SELECT wiki_title.title FROM (SELECT title FROM publicdata:samples.wikipedia WHERE timestamp > 1262304000) AS wiki_title JOIN (SELECT REGEXP_REPLACE(word, r'W', '') word, COUNT(*) FROM publicdata:samples.shakespeare WHERE LENGTH(word) > 15 GROUP BY word IGNORE CASE) AS shakespeare_word ON wiki_title.title = shakespeare_word.word GROUP BY wiki_title.title LIMIT 10;" The tables involved are publicdata:samples.wikipedia and publicdata:samples.shakespeare, both of which are public samples. They should show up when you open the bigquery web UI.

Categories : Python

ios/objective C ip spoofing sample
In order to modify an IP header, you need access to what's known as "raw sockets". Raw sockets aren't allowed on most operating system without elevated privileges. Unfortunately for you, iOS apps don't run with the required privilege for raw sockets. You might be able to do something like this from the simulator running as root, using low level C sockets: int sockfd = socket(AF_INET, SOCK_RAW, 0); But you'll get an error if you try to run this on an iOS device (not jailbroken). Spoofing an IP address has very limited use anyway. When you send data to a server from a spoofed IP address, you never see the response. Using a spoofed IP address, you'll never be able to establish any connection that requires any kind of handshake, including TCP and VPN connections. About the best use of a

Categories : Iphone

Sample operator with repetition
The following operator is state-based; there may be a more functional approach public static IObservable<TIn> SampleWithRepetition<TIn, TPulse>(this IObservable<TIn> source, IObservable<TPulse> pulse) { return Observable.Create<TIn>(obs => { var gate = new object(); var x = new {Value = default(TIn), HasValue = false}; return new CompositeDisposable() { source.Subscribe( y => { lock (gate) x = new {Value = y, HasValue = true}; }, obs.OnError, obs.OnCompleted),

Categories : C#

How to do a complex calculation as this sample
To me, it sounds like you could use window functions in a case like this. Is this applicable? Although in my case your end result would possibly look like: ID City Price Sold_Calculated 2 A 10 4 2 B 10 6 2 C 10 0 Which could have an aggregation like SUM(Sold_Calculated) OVER (PARTITION BY ID, City, Price, Sold_Calculated) depending on how far down you want to go.. You could even use a case statement if need be

Categories : SQL

Running a sample using Laravel 4
Fitst of all your authors!=Authors, so make sure of your conyroller name in the Route. And if you want RESTful controller then you can define your route like Route::controller('baseURI','ControllerName'), Laravel allows you to easily define a single route to handle every action in a controller using simple, REST naming conventions. First, define the route using the Route::controller method.. To know more check restful-controllers In your example you have to rename your get_index method to getIndex as L4 is camelCase //AuthorsController.php class AuthorsController extends BaseController { public $restful = true; public function getIndex() { return View::make('authors.index'); } } //route.php Route::controller('authors', 'AuthorsController');

Categories : PHP

Android NDK cant compile a sample app
For one reason or another, on this machine i had to create the proper file system before running the ndk-build. On other machines I didn't have to manually create folders beforehand (such as obj, local, armeabi, etc.) but on this machine i had to BEFORE running ndk-build... Hopefully this saves someone some time. I'm on a Dell i7 laptop with win764 bit professional although i'n not sure how this would affect it. I'm still very much confused about the whole thing and will accept an answer that provides some enlightenment... I'm wondering if this is a permissions thing (since ndk-build seemed to be unable to create directories) even though I do have admin rights for this machine.

Categories : Android

R prediction interval for the mean of the new sample
There used to be an R mean.data.frame function, but it was deprecated and then removed. You can get the same result with: mean.vec <- lapply(na.omit(dfrm), mean) Then probably just: predict(fit, newdata=data.frame(mean.vec) ) I say 'probably' because you provided no dataset to test this with and provision of such is in my opinion your responsibility. I have no idea whether this replicates the JMP method or the WinBUGS method.

Categories : R

Set sample rate in windows 7
It looks like you'll need to explore the WASAPI. From what I'm reading, that's the only way to programmatically force the output sample rate, besides changing the audio file itself. http://msdn.microsoft.com/en-us/library/windows/desktop/dd371455(v=vs.85).aspx You may have to search around for a C++/CLI wrapper for it (or write it yourself) to get any use out of it in .NET.

Categories : C#

WSO2 Endpoint look-up sample
I managed to get the handler sample to build by: 1) Checkout the Greg 4.5.3 Source Code: svn co https://svn.wso2.org/repos/wso2/carbon/platform/tags/4.0.5/products/greg/4.5.3/ wso2_greg_453 2) Build the source: cd wso2_greg_453 mvn clean install -Dmaven.test.skip=true I had a build failure due to maven issues cleaning up surefire reports, which I ignored. 3) Build the handler sample in the directory I unzipped the binary version of GREG to: cd %CARBON_HOME% wso2greg-4.5.3sampleshandlersrc mvn clean install This time the handler sample built ok. The approach above is a bit long winded, but it works!

Categories : Wso2

How to build android sample sdk add on x86
I have tried building it for x86 architecture in 4.1.2. You can build the x86 addon by changing the sdk.mk (for ARM) to sdk_x86.mk (for x86) in file device/sample/products/sample_addon.mk ( 4.1.2 ) # This add-on extends the default sdk product. $(call inherit-product, $(SRC_TARGET_DIR)/product/**sdk.mk**) to # This add-on extends the default sdk product. $(call inherit-product, $(SRC_TARGET_DIR)/product/**sdk_x86.mk**)

Categories : Android

Bing api sample code
In your call to Bing you are requesting the results as an Atom feed, and that's what you're getting back (38785 chars long for that particular query) and you really should treat it as an Atom feed and parse it in a more appropriate way. The reason you only get one result in your code though is that you never seem to loop over the sb string containing the feed. If you really want to parse the feed this way you need to move to code after conn.disconnect() to a loop and use something like sb.indexOf("<d:Description", int fromIndex) to traverse the string increasing the fromIndex each time you find a new match. But you really should treat the response from Bing like the xml-feed it is and parse it using some xml-library, for instance Rome.

Categories : Java

Robolectric sample gives error
Their example looks like too old. You just need to follow the instruction: http://robolectric.org/eclipse-quick-start.html And also you need to download the latest versions of libraries: hamcrest-core-1.3.jar junit-4.11.jar robolectric-2.2-20130802.075524-31-jar-with-dependencies.jar Information is valid at least for August 21 2013.

Categories : Android

Split-sample design
Here is the solution: library(plyr) mydata1<-ddply(mydata,.(GroupID),summarize,aveper=mean(head((Performance),length(GroupID)/2)), avecom=mean(tail((Commitment),length(GroupID)/2)), aveaff=mean(tail((Affect),length(GroupID)/2)),avesiz=mean(Size)) > mydata1 GroupID aveper avecom aveaff avesiz 1 1234 5 8.000 9 2 2 2235 4 2.667 8 5 3 3678 5 3.000 6 4 Update: mydata2<-ddply(mydata,.(GroupID),transform,aveper=mean(head((Performance),length(GroupID)/2)), avecom=mean(tail((Commitment),length(GroupID)/2)), aveaff=mean(tail((Affect),length(GroupID)/2)),avesiz=mean(Size),lengr=length(GroupID)) > mydata2 GroupID Performance Commitment Affect Size aveper avecom aveaff avesiz lengr 1 1234 5

Categories : R

Exporting summary(aov.sample) to CSV in R
What's wrong is that there is no regularity. These are not really "tables" but are a pastiche of text and matrices. To make this comma separated you would need to go through and replace all the spaces in the text output with commas, resulting I think in a mess. Furthermore, you are asking for this to be done with a function that you have not identified as to its source: > ?delim.table No documentation for ‘delim.table’ in specified packages and libraries: you could try ‘??delim.table’ An instance of 'aovlist' is probably just that ... a list. You could loop through the list and output the nodes that were amenable to output as regular objects. But to show you how to do it in this case would require a great deal of guesswork.

Categories : R

iOS Sample Jpeg Colors
There's another post on SO telling you how to sample an image to get the background colour: How to get the RGB values for a pixel on an image on the iphone Then you'll want to find the closest matching color, which depends on the colour space you're using: Objective C Find closest color (rgb) match I don't know of a really simple way, this is a bit more complex than you'd expect at first thought :)

Categories : IOS

Connect to sample SOAP 1.1 with PHP
Use the native SoapClient library: $client = new SoapClient('linkhere.com/AgentOnlineReservation.asmx?wsdl'); $response = $client->GetHotelsData(array( 'SourceId' => '...', 'UserName' => '...', 'Password' => '...' )); print_r($response); The link passed in the SoapClient call is the WSDL (Web Service Description Language) file.

Categories : PHP



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