FAQ Database Discussion Community


why does db.collection.findOne() return less information than db.collection.find[1] in mongodb

mongodb
why does db.collection.findOne() return less information than db.collection.find[1] in mongodb i would think the all return one document in mongodb, but when i run the commands there is some info missing using the findOne method...

Any way to convert excel cell value in to html format?

c#,html,asp.net,.net,excel
Any way to convert excel cell value in to html format ? I want to convert excel cell value in to html. Ie : Excell cell Value: 'Am a programmer' Wanna convert like: 'Am a <.b>programmer' Am reading excel using excel interop. I can check whether the entire value in...

Styling jQuery Validation error messages

javascript,jquery,html,css,jquery-validate
I've created a form page using Jade and it is being validated using the jQuery Validation plugin. I would like to style my error messages, using Bootstrap. I would like to use the .has-error class and the .has-success class. These have to be used on the parent div with class...

Is there a way to make AppCompat's ActionBar's “back/up” button act as the “back” system button

android,back-button,appcompat,android-actionbar-compat,android-homebutton
I have an app with a couple of activities. Until now I had a "hardcoded" hierarchy between them, so I had the android:parentActivityName set explicitly in each (but the launcher activity) of them. However now I added the Settings to the menu of more than one activity. Is there a...

Error in firefox with dates

jquery
Can anybody help me why this script fails in firefox, but works in all other browsers? I have a function then is the date before today, then run something. Return values: selDate : Mon Dec 01 2014 00:00:00 GMT+0100 (CET) today: Tue Dec 02 2014 09:15:06 GMT+0100 (CET) Works fine...

Path to the product in the list mode in magento

php,magento
hello guys can please anyone tell me the path to the product page in list mode in Magento.In grid mode its showing good,but when i click to list mode,i wanna remove some items from it, so please help me with the path

Maximum execution time of 360 seconds exceeded in C:\wamp\apps\phpmyadmin4.1.14

php,mysql,wordpress,phpmyadmin,wampserver
Im trying to backup a wordpress website from host and move it back on my local host and keep it as a sample for rebuilding. If have any workaround or maybe other methods I`m all ears I backedup my website and database also, but when I`m trying to "Import" my...

image creating slow down servre

php,gd,ram,uiimagejpegrepresentation
I have function and with this funqction I`m trying to create some images in my server foreach($value[0] as $imagekey => $imageval) { $imgname = $gancxadeba . '_' . $imagekey; $saveaddr = dirname(dirname($_SERVER['PHP_SELF'])).'/www/classifieds_images/'; $as = '.JPG'; $originalname = $imgname . $as; if(!file_exists($saveaddr.$originalname)) { if (preg_match('/\.(jpg)$/', $imageval)) { $getfile = imagecreatefromjpeg($imageval); }...

How to get Tomcat version number in Java [duplicate]

java,tomcat,version
This question already has an answer here: how to find out running tomcat version 10 answers How do I get the Tomcat/Catalina version number in JAVA? I've seen lots of how to do it via command line etc. but that's not code I can use, I also cannot use...

avoid redis race condition

node.js,redis,message-queue
I am trying to figure out how to avoid a race condition when I update redis. This is my scenario: I have a message that has been broken up into several http GET requests, due to query param length constraints. I am using redis to store the temporary message chunks,...

set the visibility of text box to false when the rad combo box shows empty message string

c#,asp.net,combobox,telerik,radcombobox
I have a user control in which am using one editable rad combo and one rad text box. depends on the value of combo i need to set the visibility of text box. its working. the code is as follows. 1. User Control <asp:Panel ID="pnl44" runat="server" Visible="false"> <table width="100%"> <tr>...

Load webpage from different domain

javascript,asp.net-mvc,cors
I am creating a sample project in MVC. Suppose I have two projects A and B. In project A I have a javascript file which takes index page of project A and put it in a div having id Widget. In project B index page I have a reference to...

How to inject dependencies via a construction delegate

c#,reflection,inversion-of-control,castle-windsor
I'm using a third-party library that has a setup structure like this: IEngine engine = /* singleton provided elsewhere */ var server = new FooServer(); server.AddService("Data1", () => new Data1(engine)); server.AddService("Data2", () => new Data2(engine)); server.Start(); ... server.Dispose(); (The lambda is essentially a factory method; it will internally invoke that...

Get Multiple dropdowns value of a form and send as a query string in jquery

javascript,jquery
I have a form that have dropdowns that have multiple properties .Now on click of button i want to create array of values on the key name as the dropdown name.But i am unable to do this. And i have to send the data of each dropdown in a query...

How to open image in full screen by clicking on listview in android tutorial app

android,listview,imageview
The following is what i got till now. The bug is whenever i click on ListItem the following error occurs Unfortunately app has stopped working ListViewAdapter.class public class ListViewAdapter extends BaseAdapter { protected static long[] itemVie; // Declare Variables Context context; LayoutInflater inflater; ArrayList<HashMap<String, String>> data; ImageLoader imageLoader; HashMap<String, String>...

Is there any java library /API / Framework to capture browser events?

java,api,selenium,xpath,frameworks
I know about selenium is used for automation . I need a java library / API / Framework to capture events of browsers in order to get there id, class or xPath of clicked elements.

Login across browsers?

java,html,servlets
I have a requirement. If User login into application in one browser(IE) then if user tries to open the same application in another browser (FF) then FF should not prompt for the credentials because he has already logged in and kept IE open. Is it possible in java/html/jquery?...

Partitioning graph into 2 sets of vertices

algorithm,graph
I want to partition a connected graph into 2 sets of vertices, such that the difference of sum of edge-weights among vertices of each set is minimized. For example, if a graph consists of vertices 1,2,3,4,5, consider this partition: Set A - {1,2,3} Set B - {4,5} Sum A =...

Merge column header in gridview

c#,asp.net,gridview
I've been try to merge the header column from 2 into 1, but the example and i already tried it with something like this GridView.Controls[0].Controls.AddAt(0, oGridViewRow); the question and the example that floating around was just adding 1 column, and add it in the top of the old column, not...

Possible to swap position of div elements using CSS?

html,css
In my example there are two div, I just wanted that first div come down after second div using css let suppose below example <!DOCTYPE html> <html> <head> </head> <body> <div class="div1" > This is first div. </div> <div class="div2" > This is second div. </div> </body> </html> Above code...

Xmonad, how to bind a key to running a shell script?

linux,bash,shell,window-managers,xmonad
I'm new to xmonad. Is it possible to run a shell script (say ~/x.sh) every time you click, for example, f1? How does that look in a config file? I have googled quite a bit now without finding anything that looks like what I want.

Relative Layouts - long Textview overlaps

android,textview,relativelayout,overlap
I have a relative Layout which includes two TextViews: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.pris.ViewActivity" tools:ignore="MergeRootFrame"> <TextView android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content"...

Returning a reference to an element of a class member container

c++,class,pointers,reference,member
Foo behaves like a circular iterator. Despite me being nervous about it, the code below compiles fine, but creates a run-time error. I receive the error even if I remove the consts from get_current(). Of course, I can return a pointer and it'll work; however, will I get better security...

How do you print a hash in Django 1.7 and store it in a database?

python,django
I created a hash that I am going to use later for confirmation email logic like this: import hashlib, datetime, random def hash(request): username = 'johndoe' #inserted line to simplify the code random_str = str(random.random()).encode('utf-8') salt = hashlib.sha1(random_str).hexdigest()[:5] salted = (salt + username).encode('utf-8') activation_key = hashlib.sha1(salted).hexdigest() return render_to_response('ftest/display.html', activation_key) My...

Subset data with dynamic conditions in R

r,optimization,subset
I have a dataset of 2500 rows which are all bank loans. Each bank loan has an outstanding amount and collateral type. (Real estate, Machine tools.. etc) I need to draw a random selection out of this dataset where for example the sum of outstanding amount = 2.5Million +-5% and...

css hierarchy for queries and background-image

html,css3,media
I have idea to make different size of background-image for table pc and mobile version of my site. For example: media only screen and (max-width: 480px) { .myImage { background-image:url(image_small.jpg); } } .myImage { background-image:url(image_big.jpg); } Is there any kind of hierarchy to override my picture in browsers? Do mobile...

Domain event being executed after transaction completes. How to get the concrete type.

c#,design-patterns,domain-driven-design,domain-events
I wanted to publish a domain event after a transaction completes. So I have followed this article here: http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ and also had a look at this SO post: Should I Pass a repository to a Domain Method that fires an Event Makes sense... but I am confused as to how...

How download file using java spark?

java,rest,apache-spark
I want to write simple rest api for file download. I cant find docs about it as I understood I need to set mimetype='application/zip' for response, but not clear how to return stream. http://sparkjava.com/ update: resolved here example code: public static void main(String[] args) { //setPort(8080); get("/hello", (request, responce) ->...

How to encode an arbitrary command to a exec form in Dockerfile?

docker
In Dockerfile, RUN has 2 forms: RUN <command> (the command is run in a shell - /bin/sh -c - shell form) RUN ["executable", "param1", "param2"] (exec form) How to encode >, >>, <, && || as a exec form? This is a very simple dockerfile. I want to rewrite RUN...

Angular how to toggle between search and results view and pass data

javascript,angularjs,web-services
So I am trying to do the following which I am sure is very common but haven't come across this example. View 1 and Controller 1 : Have a simple view with a textbox with ng-model="searchTerm" and ngSubmit event. Webservice gets hit with the search term and want to show...

android internal socket connection fails with a daemon service

android,c,sockets,daemon,gstreamer
I've gstreamer decoder application written in 'C' which decodes a h264 frame in Android. I want my camera service to communicate with this application. For this, I've used sockets (dgram). Am creating an unix PF_INET socket with path "/data/cam_file". Now the issue is, if I run the gstreamer application from...

order by lower have different result in oracle

oracle
I want to sort label by lower case, but I do not why I have 2 different result ? I expect the first result must be like this: 1A A_Test Btest chrismax Chrismax T test Xmax 2014 ...

partial sort a vector with lambda predicate

c++,sorting
I would like to partial sort this vector with a predicate as such std::vector<std::pair<std::string, int>> vp; std::partial_sort(vp.begin(), vp.begin()+10, [](const std::pair<std::string,int> &left, const std::pair<std::string,int> &right) { return left.second > right.second; }); However I get the error no matching function for call to ‘partial_sort(std::vector<std::pair<std::basic_string<char>, int> >::iterator,...

Butterknife View injection

android,dependency-injection,butterknife
I stumbled across a very interesting Dependency Injection library called Butterknife. Usint Butterknife it's easily possible to inject Views into activities or fragments. class ExampleActivity extends Activity { @InjectView(R.id.title) TextView title; @InjectView(R.id.subtitle) TextView subtitle; @InjectView(R.id.footer) TextView footer; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_activity); ButterKnife.inject(this); // TODO Use "injected"...

What is the difference between Thread.join and Synchronised?

java,multithreading,thread-synchronization
I am confused when to use Thread.join() and when to use synchronization in multi threading application. According to me, both of them block or wait for the execution to be done by some other thread. This example has to output 10 A's , 10 B's & 10 C's in sequential...

How to write Hg mercurial commit message with space tab and korean?

mercurial
I'm using Hg mercurial 2.8.2. My problem is about commit message when I commit using command line. Like "hg ci -m 'my test 가나다'" , mercurial rejects commit (space tab and Korean). How can I solve this problem? Do I have to re-install with another version? If I have to...

selecting element in python selenium

python,selenium
I'm trying to log onto a webpage with python selenium. I've found an element and it is enabled, but when I try to send_keys() to it I get an error. The main thing (I think) in the error output is selenium.common.exceptions.ElementNotVisibleException: Message: Element is not currently visible and so may...

API calls in angularJS right after each other

angularjs,timeout,ionic-framework
I have a problem using angular in a Ionic mobile project , I have this piece of code working great in my desktop environment. I do three API call to a web server 500ms after each other. But in the phone using a lower connection sometimes one of the call...

Do asp.net mvc apicontroller requests require async handling in addition to angular $resource

asp.net-mvc,angularjs,asynchronous,asp.net-web-api,angular-resource
If I'm using asp.net mvc ApiControllers as my backing services layer and an angular front-end using $resource, do I need to also use the asp.net mvc async pattern? I understand $resource is asynchronous and that it doesn't block the UI, but would I also benefit from using asp.net mvc's async...

Wait for the sequence to get last_value

postgresql
I have a query that gives all sequences together with the nextval: SELECT c.oid::regclass, setval(c.oid, nextval(c.oid), false) FROM pg_class c WHERE c.relkind = 'S' But it throws an error on the production database: ERROR: cannot access temporary tables of other sessions I've also created a function with last_value (to avoid...

Does afnetworking support web socket handling?

ios,afnetworking
Do we have facility for working with WebSockets in AFNetworking for iOS?

How to search in the mysql command history

mysql
The mysql command-line client supports a history (you can use the cursor-keys to access and navigate it), but is there a way to search for a string like you can do in (for example) bash? In bash you can do: history | grep "command" Is there something similar in mysql?...

How to wire up a generic repository paramater

.net,autofac
I'm getting the following error: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'HotelsLive.Application.CompanyService' can be invoked with the available services and parameters: Cannot resolve parameter 'HotelsLive.Interfaces.Repositories.IRepositoryAsync1[HotelsLive.Domain.Models.Company] repository' of constructor 'Void .ctor(HotelsLive.Interfaces.Repositories.IRepositoryAsync1[HotelsLive.Domain.Models.Company])'. The service constructor is: public...

cannot use temp (type interface {}) as type []string in argument to equalStringArray: need type assertion

go
I'm trying to pass a string array to a method. Although it passes the assertion, I'm getting this error cannot use temp (type interface {}) as type []string in argument to equalStringArray: need type assertion Code: if str, ok := temp.([]string); ok { if !equalStringArray(temp, someotherStringArray) { // do something...

How to stop slider when .mp4 video is played in mvc?

javascript,asp.net-mvc-4,video,html5-video,bxslider
i'm using "bxlider.js" plugin to slide 1 "Html<>" video and 2 image in my MVC project. My problem is when i'm playing a video, the slider is still sliding. Here is my code: $('.bxslider').bxSlider({ auto: true, autoControls: true, }); <ul class="bxslider"> <li> <video id="HomePageVdo" height="210" controls="controls" > <source class="video-width" src="~/Media/HomePageVdo.mp4"...

Trying to delete a record from my access database in visual basic studio 2010

vb.net,visual-studio-2010,oledbcommand,oledbdataadapter
Private Function CreatePlayerAdapter(ByVal playerDBconnection As OleDbConnection) As OleDbDataAdapter // Initiating instances for the function Dim dataAdapter As OleDbDataAdapter = New OleDbDataAdapter() Dim myCommand As OleDbCommand Dim parameter As OleDbParameter // establishing the string to tell where to delete record from and how to find the record i want. // PlayerIDTextBox.Text...

Why can't I Implement Streams functionality in my JAVA project?

java,stream,functional-programming,compiler-warnings,local-variables
I'm a beginner of JAVA programming. Recently, I tried to use the map & filter functionality of Streams like the following code shows. List<String> strList = Arrays.asList("abc", "", "bcd", "", "defg", "jk"); long count = strList.stream().filter(x -> x.isEmpty()).count(); System.out.printf("List %s has %d empty strings %n", strList, count); However, the compiler...

Parse.com relations count

javascript,parse.com
I want to query object from Parse DB through javascript, that has only 1 of some specific relation object. How can this criteria be achieved? So I tried something like this, the equalTo() acts as a "contains" and it's not what I'm looking for, my code so far, which doesn't...

Program halts after while loop fget()

c,while-loop,fgets
I've been trying to solve this over a few days and it's still doing my head in. I had a scrappy working program, and decided to clean it up a little, but something's gone wrong in the process. Part of the program puts csv data (from the file rfile4) into...

Why can we directly allocate bytes in ByteBuffer but not floating Point in FloatBuffer

java,memory-management,opengl-es,bytebuffer,floatbuffer
In java using openGL (ES) we can directly allocate ByteBuffer like ByteBuffer bf ; bf.allocateDirect(); But we can not do that in case of FloatBuffer it is not aviliable , why is that ? I was wondering if it is because of : Byte is accessible in hardware level (as...

AWS ios SDK - uploading objects to AWS S3

ios,swift,amazon-web-services,amazon-s3,bolts-framework
I'm trying to follow the steps listed here under "Upload an Object": http://docs.aws.amazon.com/mobile/sdkforios/developerguide/s3transfermanager.html However, I'm converting things over to Swift because that's what my whole application is written in. I've come up with the following code, but when I run it nothing gets uploaded to the bucket I specified. Unfortunately...

Javascript performances for property access : undefined vs false

javascript,performance,properties,undefined
Working with collections, I'm wondering what is the best practice between: Not defining a property (when it is missing) or defining it as false. Example: First case: [ {"age":42}, // first item {} // second item, age is undefined ] Second case: [ {"age":42}, // first item {"age":false} // second...

Long live access token granting permissions and scopes

php,facebook-graph-api
I obtained access token for my facebook app using graph api explorer and also a long lived access token from server side. But I am unable to edit the permission and scopes I obtained for the long lived access tokens. I have uploaded the screen shots of the access token...

Unable to set Hebrew Keyboard on android lockscreen for unlock phone?

android,lockscreen
So extending reference to my question. Now i am able to set Hebrew password on my android based Motorola phone. After setting this password hebrew based, i wanted to unlock the same using "Choose input method" and selecting Hebrew but phone does not shown me the key pad to do...

Can't collapse pieces of code after doing Ctrl + M, P

visual-studio-2010,visual-studio
Ctrl + M, P expands the whole document. But after doing this I can't collapse back specific methods or pieces of code. It's not possible via shortcut keys (for example: Ctrl + M, M) neither via the menu: As you can see, only Ctrl + M, O is possible which...

How to place some fields horizontal while others vertical inside a bootstrap form

html,css,twitter-bootstrap
I have a bootstrap form where I want some fields to be horizontal while others vertical. In the fiddle at the bottom, I want field 1 and field 2 to be in the same row and but of default size (not stretched). The button should be at center but in...

How to change values in a json file using XPath/JsonPath in java

java,json,xpath,jackson,jsonpath
here is the json file { "session": { "name":"JSESSIONID", "value":"5864FD56A1F84D5B0233E641B5D63B52" }, "loginInfo": { "loginCount":77, "previousLoginTime":"2014-12-02T11:11:58.561+0530" } } I want to change the value of name.by directly giving XPath/JsonPath Like ($.session.name).changevalue("MYSESSINID") this is just a Example I am correctly using jackson library and using the below code for reading via XPath...

common lisp: got different result with SBCL after saving image

common-lisp,packages
(It's the first time for me to post a question here, I searched but didn't found any useful information....) I found an interesting (which confused me for a whole damn morning) thing in common lisp. I'm using SBCL 1.1.18 running on Gentoo/Linux. Here's my problem: Suppose there's a package named...

Subsetting 700+ fips codes

r,data.frame,subsetting
I have a a list of 700+ fips codes that I'm trying to subset into a smaller dataset. I know I could just list them all out like this : data <- data[(data$fips == 65409, 84840, etc....) ,] But this is unrealistic as I have 700+ fips codes to subset....

how to run multiple projects on Apache using Virtual Hosts?

php,apache,wamp,vhosts
My vhosts are: # for localhost to work properly <VirtualHost *:1983> ServerAdmin [email protected] DocumentRoot "d:/wamp/www" ServerName localhost </VirtualHost> # - See more at: http://yogeshchaugule.com/blog/2014/how-setup-virtual-hosts-wamp#sthash.zVhOHBlJ.dpuf # - @: http://www.techrepublic.com/blog/smb-technologist/create-virtual-hosts-in-a-wamp-server/ # - @: http://www.kristengrote.com/blog/articles/how-to-set-up-virtual-hosts-using-wamp (maybe out of usable scope) # afm : Agile Farm Manager #<VirtualHost *:1983> #...

Can a property of a class be the class itself? [closed]

ios,objective-c,class,properties,self-reference
Can a class have a property and the class of the property is the class itself? @interface testClass:NSObject @property (nonatomic, strong) testClass *testProperty; @end @implementation testClass @end ...

How to create master node in node.js

javascript,node.js,cluster-computing
I'm very new to cluster/child_process modules in node.js. Can anyone let me know how can we create a master node or how to make a node as master? Most of the tutorials mention how to verify if a node is Master or Worker (below code), but not how to create...

SharePoint 2013 API - get only newly modified list items

sharepoint-2013,sharepoint-api
I'm currently using this REST service to retrieve list items: _api/lists/getbytitle('List Title')/items?$oderby=DueDate Is it possible to use some query parameter to filter the items newer/older than a specific date, using the standard Modified date field? ...

php preg_match() code for comma separated names

php,regex
I need to validate input patterns using preg_match() so that the patterns is like " anyname1,anyname2,anyname3, ". Note that there is a comma at the end too. Any letter or number is valid between the commas, numbers do not have to appear at the end. e.g "nam1e,Na2me,NNm22," is valid. I...

Objective-C Animating a character

ios
For starters I am trying to animate my main character of the game so I can later replace the images in the array with sprites - Ive done this in my header file for my main character : - (void)Animate; And in my implementation file ive written : -(void) Animate{...

How to work with overrided methods [closed]

java,override
how can i override method from superclass in Java, how to do it with constructor also? And how can i call method or constructor of superclass?

How actually Session works in MVC?

asp.net,asp.net-mvc,asp.net-mvc-4,session,session-state
I'm little-bit confused about session management in MVC4. Lets say, I entered username and password and clicked on Login button. Then on server side, I got SessionId from HttpContext.Current.Session. And then I am validating that user credentials against database. If user is valid, then Adding SessionId, userName and uiserId in...

Parameter binding and IN operator

sql,ruby,sqlite,sqlite3,parameterbinding
I'm pretty convinced it's not possible, but just in case: How do you bind the right (list) parameter for the IN operator? SELECT foo FROM bar WHERE baz IN ('cow', 'chicken'); This, unfortunately, doesn't work: list = ['cow', 'chicken'] db.execute('SELECT foo FROM bar WHERE baz IN ?', list) Parameter binding...

Unable to find out reason of error Cross-thread operation not valid from C++ callback to C#

c#,c++,dll
I'm going to implement MVC structure of delegate same like in Objective-C. Basically my functionality is like Bluetooth device return me signal i grab it in C++ Callback and that signal message i going to forward to callback of C# lambda function. I got following error, Cross-thread operation not valid:...

SubQuery using IN operator

mysql,sql,select,in-operator,find-in-set
I have a table named 'user_permission' there is a column named location_ids and data type is varchar(255). I stored here value like 10,27,36. Now I want to use this 'location_ids' in a IN comparison operator. The following query I have tried, but I did not get my expected result....

WSO2 APIM The system cannot infer the transport information from the /devtest/1.0/users/admin

http,wso2,wso2esb,wso2-am
Hi I have an API with a custom sequence (dblookup & switch sequence) that will verify if a user is existing on the database, if not it should send a http status 401: Unauthorized, below is the case code but I always get an error cannot infer the transport information....

Coredata predicate IN operator with like or contain

ios,objective-c,core-data,predicate
I have two arrays on which I have to do the wildcard search and I am using the IN operator but the IN operator gives me the exact matching but I want to fetch all the results that contains the searchTerm. Is this possible through IN operator or do I...

How to layout images in a grid? [closed]

jquery,html,css
I have 3 rows of images. Each image is made up of: <span class="tribeimg"> <img src="images/tribes/img.jpg"> <p class="lt-tribe-name">Tribe Name</p> </span> with CSS.. .tribeimg { background-color: black; display: inline-block; position: relative; width: 140px; height: 140px; } .tribeimg img { opacity: 0.7; position: absolute; left: 0; top: 0; } .tribeimg img:hover, .tribeimg...

Display data from database without being effected by html tags

html,css,asp.net-mvc
In my database there is html tags , such as Hello <br/> world And I use the following code in my view to display this data: <span> @Table.text </span> but the problem is that the data is displayed with break line , it is displayed as Hello world And the...

Placing divs side by side, but not in line

html,css
Consider the follwoing html code: <h3>CPU Plot </h3> <div id="CPU1"></div> <h3>CPU Plot </h3> <div id="CPU2"></div> <h3>CPU Plot </h3> <div id="CPU3"></div> <h3>CPU Plot </h3> <div id="CPU4"></div> CSS goes like this: #CPU1{ width:600px; height:300px; margin-top: 20px; float:left; } #CPU2{ width:600px; height:300px; margin-top: 20px; float:right; } #CPU3{ width:600px; height:300px; margin-top: 20px; float:left; }...

Get complete certificate chain including the root certificate

ssl,openssl
How do I get complete certificate chain for a server? Though some claim one should be able to do just that with openssl s_client -showcerts, it turns not always to be the case. echo | openssl s_client -CApath /etc/ssl/certs -connect www.ssllabs.com:443 \ -showcerts | grep -B2 BEGIN depth=3 C =...

A long UIButton title label truncates in the center instead of on the right

ios,objective-c,uibutton,nsstring,ios8
I am testing the following code: username = @"addagkagalkjagjalggxxaklgjagjglkjag"; NSString *fullUsername = [NSString stringWithFormat:@"%@%@", @"@", username]; UIButton *usernameButton = [UIButton buttonWithType:UIButtonTypeSystem]; [usernameButton setTitle:fullUsername forState:UIControlStateNormal]; usernameButton.frame = CGRectMake(100.0, 10.0, 215.0, 25.0); The end result truncates and ellipses in the center of the label. I want it at the end but what...

Where should I put background images in different screensizes?

android,android-layout,screen
I've been reading about the drawable-XXdpi folders, and I created my icons in all sizes. What I want to do now, is to put a background image on my main screen. And what my assumption is at this moment, is that I don't work with DP at this moment but...

unrecognized selector sent to instance with swift

ios,swift,apple
I'am trying to make slideshow app with swift but I have problem,, in main.storyboard I add 1 imageview and 1 button -when user click btn slideshow will animating-. I wrote this code at viewController.swift @IBOutlet var ImageView: UIImageView! @IBOutlet var animateBtn: UIButton! @IBAction func animateBtnClicked(sender: UIButton) { startAnimation() } var...

how to handle this InputMismatchException?

java,inputmismatchexception
In the code below I'm getting InputMismatchException at line 80 even before I'm giving the input. Why is this? try { loop:while(true) { choice=sc.nextInt(); switch (choice) { case 1: term=3; break loop; case 2: term=6; break loop; default: System.out.println("Invalid Input.. Enter again"); choice=sc.nextInt(); } } } catch (InputMismatchException e2) {...

Crypto++ pbkdf2 output is different than Rfc2898DeriveBytes (C#) and crypto.pbkdf2 (JavaScript)

c++,rijndael,crypto++,pbkdf2,hmacsha1
So I'm trying to use PBKDF2 to derive a key given a base64 string of 256bits. I am able to use C#'s Rfc2898DeriveBytes and node-crypto's pbkdf2 to derive the same key, however, I can't say the same for C++. I'm not sure if I'm doing wrong conversions or using the...

How do I print time in a file at different point of execution by opening the file only at the end?

c
I am trying to print time twice in a file. The code is shown below. The output is not coming correct, it is just printing some values which are not what the current time is. The issue is I have to call fprintf only once and that too at the...

Assignability of two matching interfaces having different versions

c#,.net,reflection,interface
I have two Assemblies with the same name and the same public key token. Both assemblies contain the same interface with the same name in the same namespace. The only difference between the two assemblies is their version (1.0.0 vs 1.0.1). But when calling bool assignable1 = typeof(Interface1).IsAssignableFrom(typeof(Interface2)); bool assignable2...

how to get the pcm data of android?

android,android-ndk,audio-recording,pcm
i'm try to get pcm data by class AudioRecord, the source of audio from headset,it linked a device ,the device will send some wave to my app(i hope you can understand what i say).![difference device's wave],the picture at http://i.stack.imgur.com/5iZnY.png we see the picture, wave 1 and wave 2,i can get...

Getting a validation error in mongoose even though files are provided

node.js,mongodb,express
I am getting a validation error with the following message on saving to database even though I have provided all the fields, { [ValidationError: Validation failed] message: 'Validation failed', name: 'ValidationError', errors: { Name: { [ValidatorError: Path `Name` is required.] message: 'Path `Name` is required.', name: 'ValidatorError', path: 'Name', type:...

Wrong TCP checksum calculation by Scapy

python,tcp,scapy
After asking this, I just wanted to make a simple test. I captured a traffic using tcpdump. Filtered out a TCP ACK packet in Wireshark and exported the filtered packet to sample.pcap. Now this is pretty much my code for TCP checksum recalculation: from scapy.all import * ack_pkt = sniff(offline="sample.pcap",...

Roots of a non-linear equation using Matlab

matlab,equation,equation-solving,nonlinear-functions
I am using Matlab to find the roots of a non-linear function. The equation is lengthy and I have used another .m to save the function, the code for which goes like function x_c = f_x_c(s,H,VA,Lo,qc,EA,NF,Sj,Fj) if (s < 0) || (s > Lo); disp('The value of s is invalid')...

How Can I Compare and Hold Some Value : SQL SERVER 2008 R2

sql-server
I have a table looks like this: ITEM | DATE | PRICE | NEW_PRICE | REDUCTION | Pencil | 01/10/14 | 25 | 21 | 4 | Pencil | 01/12/14 | 21 | 21 | 0 | Pencil | 01/30/14 | 21 | 21 | 0 | Pencil | 02/05/14...

Why does this cause “Mismatched anonymous define()” in requireJS?

javascript,browser,requirejs,amd,classiejs
I'm using a module called classie.js, whose codes can be viewed below: /*! * classie - class helper functions * from bonzo https://github.com/ded/bonzo * * classie.has( elem, 'my-class' ) -> true/false * classie.add( elem, 'my-new-class' ) * classie.remove( elem, 'my-unwanted-class' ) * classie.toggle( elem, 'my-class' ) */ /*jshint browser: true,...

How can I deal with undesired template instantiation for a function that isn't called?

c++,templates,c++11
I'm trying to implementing some code where I want to call certain templated methods based on type traits. Unfortunately, the methods are instantiated with types (that are never called with said types) that are incompatible with the function, which causes compilation errors. Ideally I could use the traits to prevent...

Can't add a line number to the beginning of each line with awk

awk
I'm trying this awk command awk "{print NR, $0}" file1.csv, but it's adding the line number followed by a space and not a comma. I tried other commands with the same results awk "{print NR "," $0}" file1.csv And I have an error wherever I use a single quote. I'm...

Get value from directive in html table

javascript,angularjs
I am using angular js. I want to get value from input inside a row in table. Below there is an input element. When i click the button (add) i need to get the value for that particular row. view <tr ng-click="" ng-repeat='customer in customers | filter:query | orderBy: sort.field...

iOS - Get File Size of Image Selected From Photo Reel

ios,objective-c
I'm building an app that allows users to select photos and videos from their device and upload them to the server. Trying to get the file size (in bytes) of each item select, can anyone help me out? if ([dict objectForKey:UIImagePickerControllerMediaType] == ALAssetTypePhoto){ // image file if ([dict objectForKey:UIImagePickerControllerOriginalImage]){ NSURL*...

How to update Activity from thread started in another activity?

java,android
I have a Main activity and after click on button I start thread (but the thread is hidden in library and I have only callback in Main activity. Now I want to start another activity (call A) where I want to put results from the thread. Below is simplified code:...

Changing the name of a html class with for loop variable

javascript,jquery,html,html5
I have several of html class's incrementing up in class name such as: <div class="chicken1"> <b></b> </div> <div class="chicken2"> <b></b> </div> <div class="chicken3"> <b></b> </div> I'm trying to write a for loop which will loop through these class names, adding the index to the end each class name and then...

Can't find file, chart does not appear

javascript,php,morris.js
I have this code : <script> var area = new Morris.Area({ element: 'revenue-chart', resize: true, data: [ {y: '2011 Q1', item1: 2666, item2: 2666}, {y: '2011 Q2', item1: 2778, item2: 2294}, {y: '2011 Q3', item1: 4912, item2: 1969}, {y: '2011 Q4', item1: 3767, item2: 3597}, {y: '2012 Q1', item1: 6810,...

Ruby on rails relationship reference saving

ruby-on-rails,ruby,ruby-on-rails-4
I'm just wondering what is the best practice in saving this kind of data Here's the relationship of the models class User < ActiveRecord::Base has_many :posts, dependent: :destroy has_many :comments, dependent: :destroy end class Comment < ActiveRecord::Base belongs_to :post belongs_to :user end class Post < ActiveRecord::Base belongs_to :user has_many :reviews...

How open youtube video manually with fancybox

javascript,fancybox
I am building an angularJS webapp and I want to open a youtube video by calling a method of my constructor. To achieve that; I want to reproduce the same behavior as $(document).ready(function() { $('.fancybox-media') .attr('rel', 'media-gallery') .fancybox({ openEffect : 'fade', closeEffect : 'fade', padding: 0, helpers : { media...

SQL counting row number for every same column result

sql-server,rowcount
First of all, sorry for my bad English. I have a problem creating a SQL statement. I created a row count column: SELECT ROW_NUMBER() OVER(ORDER BY KNR DESC) AS Row, KNR, text, DATUM FROM KURSTAGE WHERE (KNR like '%E3%') AND (TEXT = 'TEXT') AND ( datum >= '02.12.2014') AND (KNR...

How to share video on flickr

ios,objective-c,video,hyperlink
i m working an IOS app in which i needs to share a video/(or video link) on flickr . i search a lot but didn't get as required . Plz provide me code or clue for doing this . thanks in advance....