FAQ Database Discussion Community


SQL syntax error in DELETE statement

vb.net
When executing a DELETE SQL statement i get an error message SYNTAX ERROR NEAR '*' What could be the error in the following code ? Public Sub dele() Try Dim con As New SqlConnection("Data Source=192.168.10.3;Initial Catalog=IT_INV;user id=sa;[email protected]") con.Open() Dim inventtable As New DataTable("pc") Dim rs As New SqlCommand("DELETE * FROM...

Which one to use in Angularjs : Factory, Service and Provider?

angularjs
Hi I am new with Angularjs. I am reading about Angular service. I have read the following what-is-difference-between-factory-service-and-provider and service-vs-provider-vs-factory. To me, it seems like they are just different way of achieving same goal (please correct me if I am wrong.) Now I am wondering as they all serve the...

Dynamic table in universal app

c#,wpf,mvvm,win-universal-app,stackpanel
I am developing universal app for windows phone 8.1/windows 8.1. I am using MVVM pattern. I have table with dynamic number of stackpanels that are bind to source in view model. One stackpanel is one row in the table. How can I make items in stack panels same width? I...

Getting stream Closed in spring controller + angularjs

angularjs,spring
I want to save my textbox details into master table and table details into sub table. when i do it separately it works fine.. but when i done it same time it gave an error as stream closed.. Then how will i resolve this.. please help me.. My js part...

What are the technology used to develop shopping apps like jabong, myntra, flipkart etc.? [closed]

android,ios,hybrid-mobile-app,multi-device-hybrid-apps
What are the technology used to develop shopping apps like Jabong, Myntra, Flipkart etc. ? Can anyone provide more details or any link to know about hybrid app development. I am a beginner and i am unaware about hybrid app development technologies. I tried googling but could not find which...

Chrome Vox not getting radio buttons

html,google-chrome,radio-button,accessibility,wai-aria
I'm testing a website for accessibility using Chrome Vox. I have 3 radio buttons, one of which is selected. I have no idea why, but Chrome Vox only reads the selected radio button, the others are ignored. Here's an example: <p>Chrome Vox test</p> <input type="radio" id="radio1" name="radio" tabindex="0" role="radio" aria-checked="false">...

How to have multiple PagedListRenderOptions in PagedList.Mvc?

c#,asp.net-mvc,pagedlist
I am working with c# and I am making an Ajax call using PagedList.Mvc. The code in my cshtml view is the following: @Html.PagedListPager(Model.PagedList, page => Url.Action("SearchTable", "JobOffer", new { randomParameters = "BANANAS" page = page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing( new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "tableAndPaginationDiv" } ) )...

How to remove all the mappings of a particular object in java hashmap?

java,hashmap
I have a many-to-one mapping in java hashmap. I iterate through all the values by using java.util.HashMap.values(). Now if I want to delete a particular value and all the corresponding keys, then what should I do? Will just using java.util.HashMap.remove(Object key) with one of the keys suffice?...

Adding select to parent through function called by succes function of ajax retriever

javascript,php,jquery,ajax,dom
So basicly I'm gathering data from a file, this data is as follows: [{"course_id":"1","name":"test"}, {"course_id":"2","name":"test1"}, {"course_id":"3","name":"test2"}] Javascript/jquery code is as follows: function createSelect(data) { for(i = 0; i < data.length; i++) { console.log(data[i]['course_id'], data[i]['name']); var select = $('<select></select'); $(this).parent().append(select); } } $(document).ready(function () { $('.note').click(function () { switch($(this).attr('id')) { case...

Modifying Structure's variable Data

c++,struct,queue
Front function of user defined Queue template<class Type> Type queueType<Type>::front() { if(!isEmptyQueue()); return list[queueFront]; } int main() { struct process { int burst; }pro; int tq=2; pro.burst=10; Queue<process> RR; RR.enQueue(pro); RR.front().burst=RR.front().burst - tq; } when i try to run this line: RR.front().burst=RR.front().burst - tq; it gives the following error: using...

a href tag is not working in internet explorer

html,css,cross-browser,href,internet-explorer-11
I am creating a button using a href tag in my page which is working fine in chrome. but it is not at all working in internet explorer the code for the button is <td class='swMntTopMenu' style="text-align:right"> <button style="background-color:rgb(255,213,32)"> <a href ='list.php' style="text-decoration:none !important;"> <div class="link"> Back </div> </a> </td>...

Swift Syntax Update? Classes not allowed in protocol. Can't fill SKTexture

ios,swift,protocols,sktexture
I'm currently working on a tutorial for creating an iOS Isometric Game. You can find this one here. I just started coding Swift and because a lot of Syntax errors appeared while working with tutorials a little older than 3 months I asked my self if there were some main...

Datatrigger Change ImageBrush source

wpf,xaml,controltemplate,datatrigger
Currently am working on a reversi game and this is the ControlTemplate for a Stone on the board , Am using a DataTrigger to see who the Owner is for the Stone to set the button to the appropriate Image , But when I use TargetName on the setter (To...

App compiles WITHOUT protocol functions - why?

ios,swift,protocols
Beginner with swift so please be gentle I'm playing around with the AppDelegate.swift file in the Master-Detail sample provided with XCode. The Appdelegate file has the first line class AppDelegate: UIResponder, UIApplicationDelegate { Which I understand to mean that AppDelegate is a sub-class of UIResponder and conforms to the UIApplicationDelegate...

can “default_popup” (in manifest.json field) have full file path?

google-chrome-extension
Im writing chrome extension and I want to use a *.html file as default_popup. the file is located outside my project folder. I want to write something like: ... "browser_action": { "default_icon": "icon.png", "default_popup": "..\MembershipApp_v2\build\web\index.html" }, ... but the chrome replies: Failed to load extension from: ~\Desktop\6_5_15\plugin_proj Manifest is not...

Excel Web Import Date recognition

excel,date,web,import
I would like to know if it's possible to set the Date format only for certain columns. The problem is when I set the Format after downloading the Data from Web it will reset when I Update the Data. But when I keep the Date recognition on it will format...

Rapidminer sustituir valores numericos que se encuentran en un rango

range,rapidminer,substitute
Utilizando Rapidminer Studio 6 tengo que sustituir los valores de un atributo que están fuera de un cierto rango, por 0, y no sé que operador puedo utilizar (o combinación de operadores). Por ejemplo, si tengo para un atributo los valores 1 2 3 4 5 6 7 y aplico...

Draw multiple rectangles with dividers in-between

java,android,android-layout,android-activity,android-canvas
I'm trying to draw the image below but I'm not sure as to how to draw the grey and black rectangles. The red rectangles I've done perfectly hence would be grateful for someone to tell me hat can be done to achieve the following: 7 grey rectangles to be the...

Sorting an array from a MYSQL output and omitting duplicate values

php,mysql,arrays,select
My query returns from my database rows of data containing arrays of years. For example: 1 > 2004,2005,2006,2007 2 > 2003,2004,2005 3 > 2004,2005,2006,2007. When I select this data I combine it into an array then use array_unique to filter out the duplicates, however this does not work. I am...

Table row sorting based on the sum of the each column in jquery

jquery
Actually, I have this table and need to sort the 'rows' based on the highest value[i mean, in a row, sum of all the columns.]. The last row is total that should also sum automatically. If I press the 'Top 5', only top 5 rows[based on the sum of cols]...

Indicator column for treatment variable creation

r
I am relatively new to R and am having some trouble adding the indicator column I need. In the picture you can see there is a column labeled "lawchange" I would like to create an indicator column which tells if the state had this law change take place or not...

Compilation failure when using a base class reference as a predicate

c++11
class baseFunctor{ virtual ~baseFunctor() {} virtual bool operator()(const A& lhs, const A& rhs) = 0; }; class derivedFunctor : public baseFunctor{ bool operator()(const A& lhs, const A& rhs) override { //implementation// } }; Inside another unrelated method, I have : baseFunctor* functor = new derivedFunctor(); std::vector<A> vectorA; My intention is...

Asynchronously load data in android

android
what is meant by asynchronously loading data in activity or fragment in android? This is my question. I searched everywhere. I'm not getting a generalized definition for this?. I can't get the term mentioned in android developer also. Can anyone provide me the basic explanation of this term?

Using jquery to obtain Radio value doesn't work without using
declaration

java,php,jquery,html
I tried to to extract the value from a few radio buttons, but it does not work. I know there is a working answer if <form="name of form" > is declared however I do not wish to declare form in it as I am echoing out those radio buttons. Here...

Redirecting a link to a diffrent link in htaccess

.htaccess
How can I redirect these links to their target links example.com/a => example.com/b example.com/c => example.com/d example.com/d => example.com/e with Htaccess? thanks in advance....

R: How to Draw heat map divided by a digonal line?

r,plot,ggplot2,lattice
I came across this article on Nature Methods which provided a very nice heatmap: http://www.nature.com/nmeth/journal/v12/n4/full/nmeth.3311.html Different from other heat map is each rectangle is divided by a diagonal line, with 1 part represent the literature data and the other in-house data. I think this is a very nice way to...

ElasticSearch search for special characters with pattern analyzer

elasticsearch,tokenize,query-analyzer
I'm currently using a custom analyzer with the tokenizer set to be the pattern (\W|_)+ So so each term is only letters and split on any non letter. As an example I have a document with the contents [dbo].[Material_Get] and another with dbo.Another_Material_Get. I want to be able to search...

jquery ui sortable cannot drop cell into newly visible div

javascript,jquery,jquery-ui,jquery-ui-sortable
Simplest to see in a jsfiddle Links to jsfiddle must be accompanied by code, therefore I am copying the js here: $('.row').sortable({ placeholder: 'cell placeholder', forcePlaceholderSize: true, items: '.cell', connectWith: '.row', dropOnEmpty: true, distance: 0.5, tolerance: "pointer", start: function() { $('.row').css('min-height','30px'); }, stop: function(event, ui){ $('.row').css('min-height',''); } }); the problem...

using rails for a very thin application [closed]

ruby-on-rails
I've been working on a large website with Ruby on Rails for more than 2 years now and found it really convenient and easy to code a web application or service. Now I want to build a really thin web service: no DB, no front end 1-2 controllers with 2-3...

DB2, when trying to calculate difference between provided and stored timestamp I get an error 'The invocation of function is ambiquious'

sql,jdbc,db2,db2-luw
This is my sql string from which I prepare statement: SELECT (DAYS(?) - DAYS(FROM)) * 86400 + (MIDNIGHT_SECONDS(?) - MIDNIGHT_SECONDS(FROM)) AS FROM_DIFF, (DAYS(?) - DAYS(TO)) * 86400 + (MIDNIGHT_SECONDS(?) - MIDNIGHT_SECONDS(TO)) AS TO_DIFF FROM CALENDAR.EVENTS WHERE ID = ? fill values with the following code: ps.setTimestamp(1, new Timestamp(...)); ps.setTimestamp(2, new...

Uncaught Error: Syntax error, unrecognized expression in Yadcf select type

datatables,yadcf
I am having a problem with select type in Yadcf. It does not allow brackets. I have this code { column_number: 9, filter_type: 'select', select_type: "select2", column_data_type: "html", html_data_type: "text", filter_match_mode: "exact", filter_default_label: "Select status", }, HTML: <td>Identified (In progress)</td> So when page is loaded I have the error Uncaught...

Using forms in tests

c#,winforms,mstest
I have an integration test that makes a form appear. It is not a coded UI test, it is just a test that happens to use a form. Lets not discuss now, that in general it is a good idea or not, it is in my case necessary. If everything...

Jssor Slider 2 sliders combination

jssor
Is there a way to combine Carousel Slider and Nearby Image Partial Visible Slider? I want to show 6 images - 4 full visible and 2 partial visible at the ends.

Deserialize with Json.Net fails on some fields

c#,json,json.net,deserialization
I try to deserialze Json into a c# object using Json.Net. c# class: public class Evaluation { [DataMember(Name = "id")] public int Id { get; set; } [DataMember(Name = "avg")] public string Average { get; set; } [DataMember(Name = "median")] public string Median { get; set; } [DataMember(Name = "teacherID")]...

Refreshing winform ComboBox datasource on closing a dialog form

c#,winforms,combobox
I have a settings form, on which there is a combo box that I fill with divisions from the database. Next to this combo box there is a "new" button the user can click to create a new division. When the New button is clicked, a dialog form pops up...

How can I find the sum of a list of numbers with basics of recursion?

python,list,python-2.7,recursion
"Write a recursive function, "listSum" that takes a list of integers and returns the sum of all integers in the list". Example: >>>> listSum([1,3,4,5,6]) 19 I know how to do this another way but not in the recursive way. def listSum(ls): i = 0 s = 0 while i...

R: Handling NaN values in t.test

r,nan
I have many vectors on which I should perform one t-test for each. each of these vectors contain data relative to two groups, but some values are missing. Fo eaxmple, one of such vectors may be: A <- c(1, NaN, 1.2, 1.5, 5.6, 5.1, 4.8, 4.7) where the factors are...

Count of files in C# with LINQ

c#,arrays,linq
Env: C#, VStudio 2013, 4.5 Framework, Winforms Goal : Getting the number of files (Count) in a folder and subfolder that match extensions stored in an array of string. The array of extension can be with the "." of not. {".dat","txt",".msg"} What i've done so far : When I'm having...

session.getDatabase returns null

javascript,xpages
I'm trying to open my own database via Xpage using JS on beforePageLoad event. I have this code: var db:NotesDatabase = session.getDatabase("x", "y",false); var dbCount = db.getAllDocuments().getCount(); X contains the server name and y the database name. I've tried this with other databases and still got null all the time,...

Equivalence of class reluctanct and simple class regular expression

java,regex
This is a question just to satisfy my curiosity. Consider the following two Java regular expressions: [, !.] and [, !.]+?. Are they equivalent? I have tried to come up with examples where they wouldn't be equivalent, but I cannot find one. EDIT: I understand that for the sake of...

Ucanaccess connection of my Android app with a huge MS Access database is taking too much heap space on Android device. Any alternatives?

java,android,jdbc,ucanaccess
I am developing an Android app that needs to fetch data from a huge MS Access database of 120MB size. I have written code to establish connectivity and execute a simple query on the database. I run the same java code on my laptop and my Android device.Here's the code:...

Unable to pass 'is not null' query to server side

ios
Situation I want to search data from database. My logic If my textfield length is zero then pass 'is not null' value to server side. Otherwise pass the textfield data to server side. Client side: UILabel *first=[[UILabel alloc]init]; UILabel *sec=[[UILabel alloc]init]; if (_zip.text.length==0) { [email protected]"is not null"; } else if...

YAML::Syck generates list instead of hash

perl,yaml
If I run the below script, then the two hashes are the same, but when I look at how the yaml file looks I see this very weird format --- nicPri --- ixgbe1 --- nicPub --- ixgbe2 --- slaves --- 47: 10.10.47.47 48: 10.10.10.48 --- ipPri --- 10.10.10.46 which doesn't...

Can't install TCP Activation on Windows 8.1

.net,wcf,tcp
I'm following a tutorial on WCF. In it, I get the instruction to turn on TCP Activation in the "Turn Windows features on or off" menu. See this screenshot: However, after selecting it and pressing ok, I get this: Googling error code 0x800F0922 yields no results, and no matter how...

Get files modified/added/removed from a commit in LibGit2Sharp

c#,git,libgit2sharp
I've this method, where I get files from my last commit: static void GetFiles(Tree t, String dir = "") { foreach (TreeEntry treeEntry in t) { if (treeEntry.TargetType == TreeEntryTargetType.Tree) { Tree tr = repo.Lookup<Tree>(treeEntry.Target.Sha); GetFiles(tr, dir + "/" + treeEntry.Name); } else { string caminho = dir + "/"...

concatenating string with variable in erlang

string,erlang,string-concatenation
I have below string in erlang which I get from Msg#archive_message.body {\"message\":\"tttfdfdfdfdddtt\",\"customid\":\"454dddfdfdfd\"} I need to make it <<"{\"message\":\"tttfdfdfdfdddtt\",\"customid\":\"454dddfdfdfd\"}">> and pass into a function. any help is appreciated....

How do I compare two Python Pandas Series of different lengths?

python,pandas
I have two Series of different lengths, and I want to get the indices for which both the indices and the amount are the same in both series. Here are the Series: ipdb> s1 s1 000007720 2000.00 group1 -3732.05 group t3 2432.12 group2 -38147.87 FSHLAJ -36711.09 EWkayuwo -3.22 Name: amount,...

Stop Apache CXF logging binary data of MultipartBody attachments

java,logging,cxf,interceptor
I need to stop CXF from logging the binary data of attachments in a MultipartBody object (which is being thrown out by the AbstractLoggingInterceptor in the Outbound Message). When I add my LoggingInInterceptor, I am setting setShowBinaryData to false, but this doesn't seem to stop binary data within a multipart...

Symfony2 Best way to implement database translations

php,symfony2,doctrine2,translation
I'm refactoring a multilanguage website to symfony. The site has plenty of language stuff stored in databases (product descriptions, product name...) and a language table. It looks pretty much like these: Table product: -id -price -stock -... Table product_language: -id_product -id_language -name -description Table language: -id -name -code So I'm...

management permissions for chrome extension in content script

google-chrome-extension
I have an chrome extension that should check whether another extension and add a div to every web page in my-website.com if it is not. So i put this in the manifest: "background": { "scripts": ["background.js"] }, "content_scripts": [ { "matches": ["http://my-website.com/*"], "js": ["content.js"], "run_at": "document_end", "all_frames": true } ],...

How to use Web Browser Control in for loop?

c#,webbrowser-control
I am working on web crawler in which it checks the results of students from same website. I am able to submit the form and select elements but the problem is that i want to use web browser control in a loop. for (int i = 3910001; i < 391537;...

Syntax while setting schema for Pyspark.sql using StructType

apache-spark,pyspark
I am new to spark and was playing around with Pyspark.sql. According to the pyspark.sql documentation here, one can go about setting the Spark dataframe and schema like this: rdd = sc.textFile('./some csv_to_play_around.csv' schema = StructType([StructField('Name', StringType(), True), StructField('DateTime', TimestampType(), True) StructField('Age', IntegerType(), True)]) # create dataframe df3 = sqlContext.createDataFrame(rdd,...

Codeigniter Image upload ignore allowed types and file size

php,codeigniter,image-uploading
I have below code to upload user image, my code work good but I'm getting issue while checking allowed_types i.e. png|jpg and max_size.. It doesn't check allowed type and max size Code: $this->load->library('upload'); $config['upload_path'] = 'admin/upload/'; $config['allowed_types'] = 'jpg|jpeg'; $config['max_size'] = '100'; $this->load->library('upload', $config); $this->upload->initialize($config); $this->upload->set_allowed_types('*'); if (!$this->upload->do_upload('user_image')){ $data =...

Why is my ListView item selected, but not highlighted after click?

android,listview,android-listfragment
I'm working with the Master-Detail Flow and using a Custom ListView, which is defined by a BaseAdapter. After user touches the List item it doesn't remain selected. I thought I could solve it by defining a selector, <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Selected Item --> <item android:state_selected="true" android:drawable="@android:color/background_dark" />...

Selecting a record with max value on one of the joins

sql,sql-server,greatest-n-per-group
I have three related tables and need to select rows that show data from two tables based on a value (serial number) from the third. I am only interested in the max value of the serial number. I have tried multiple solutions suggested here on stackoverflow and I still cannot...

using Autofac with XML configuration

c#,xml,dependency-injection,autofac
I am trying to decouple an implementation where the interface is know and the implementation would be defined in App.Config. But it doe not seem to be able to resolve the interface. This is what I am doing : <configuration> <autofac defaultAssembly="My.Service"> <components> <component type="My.Services.Service, My.Service" service="My.Abstractions.IService, My.Service" instance-scope="per-lifetime-scope" instance-ownership="lifetime-scope"...

Find files and tar them with trailing or leading space in their name

linux,bash,tar
I have a script, that tries to archive the contents of a directory with tar: #!/bin/bash find /root/files -type f -name "1*" -print0 | while read -d $'\0' file do MYDIRNAME=$(dirname "${file}") MYFILENAME=$(basename "${file}") MYMODIFYDIR=$(echo "$MYDIRNAME" | sed 's/^\///' | sed 's/\//_/g' | sed 's/\ /_/g') MYMODIFYFILENAME=$(echo "$MYFILENAME" | sed...

Checking for multiple values with in same coloum

mysql,sql,filter
This is how my database table structure looks - ID fieldname fieldvalue 1 country USA 2 language English 3 country India 4 language Hindi So I want to select the rows where the fieldname is say 'country' and fieldvalue is USA AND fieldname is language and fieldvalue is English. Basically...

How to track AJAX site search using Google Analytics?

javascript,jquery,ajax,google-analytics
I'm using AJAX (POST method) for my site search. Here's my AJAX call: $.ajax({ url: 'ajax.php', type: 'POST', dataType: 'json', data: { search_phrase: search_phrase }, success: function(data) { ... My aim is to use Google Analytics to start tracking search terms. Any idea how this can be done?...

Avoid clash of positions in a matrix algorithm

algorithm,matrix,nearest-neighbor,neighbours
Assume you have a n x m matrix. In this matrix, you will be randomly positioning FOUR different objects say a, b, c, d. There will be many of each. Now what is the best algorithm so that when they are randomly placed, their positions don't clash? My approach would...

IModelBinder: access the raw data of the request

c#,asp.net-mvc,asp.net-mvc-5,model-binding
I am trying to look at the text sent in a POST through the IModelBinder interface. I have something like: public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { if (controllerContext.HttpContext.Request.ContentType.ToLowerInvariant().StartsWith("my special content type")) { var data = ??? ...where the ??? should be the text that was sent in the POST....

Android GridView (Caldroid) scroll margin on the bottom

android,gridview,scrollview,caldroid
I have a Caldroid Fragment that generates a calendar based on a GridView. It takes the complete screen. Then I added an AdView on the bottom of this activity, the problem is that banner covers some cells of the grid so user can't click on them. Basically, I want to...

Arabic characters from html content to pdf using iText

html,pdf,text,itext,arabic
I am having trouble to display the Arabic Characters from HTML Content in PDF Generation as "?" I am able to display the Arabic text from String variable. At the same time I am not able to generate the Arabic Text from the HTML String. I want to display the...

What does 'times=X' in Web2py LOAD-helper?

web2py
In the Web2Py book I found this: It states that: times specifies how many times the component is to be requested. Use "infinity" to keep loading the component continuously. This option is useful for triggering regular routines for a given document request. How and when could this be used?...

Is there any difference in those two way of casting?

java,casting,bytecode
In the following code Object o; //getting o Integer i = (Integer) o; //1 Integer j = Integer.class.cast(mapValue); //2 is there any difference between //1 and //2? I mean, in JVM all those cases are going to be carried out with the same bytecode instructions, is that right?...

Google table chart visible on button click

jquery,css
Trying to load a page with a google table chart as hidden and only show it after a button click. If I start the page with the table not hidden I can toggle it, but if I start with the table hidden that isn't possible. Here is a jsfiddle. Swap...

Make Python 2 compatible with Python 3

python,porting,2to3
My current requirement is to write a script in Python 2.4.3 which comes bundled wit RHEL 5 . But few years down the line say 5 yrs ,the server may be upgraded to RHEL 8 or 9 which comes with Python 3. So I am supposed to write the code...

In Django-admin, how to add filter or search for foreign key select box?

python,django,django-models,django-forms,django-admin
I got a foreign key model with about 100,000 date. It's too difficult to select the wanted data. So I'm wondering if there is a humanized way to add foreign key in django admin. I have tried the raw_id_fields, it's useless. this don't work....

Returning a reference from a pointer

c++,pointers,c++11,reference,singleton
I have this class in singleton.h: class SingletonSample { public: static SingletonSample& Instance(); int DoSomething() const; private: SingletonSample(); ~SingletonSample(); SingletonSample(const SingletonSample&) = delete; SingletonSample& operator=(const SingletonSample&) = delete; static SingletonSample* _instance; } And I have this implementation in singleton.cpp: SingletonSample::SingletonSample() {} SingletonSample::~SingletonSample() {} SingletonSample& SingletonSample::Instance() { if(!_instance) _instance = new...

How do you write a multiple condition IF statement with the same output?

excel,if-statement
I've been working on a file for fun for MONTHS now. It is something that I'm passionate about and I have been making it available to other collectors. It is a tracking sheet for a particular set of baseball cards. I've finished the design and most everything else. I've slowly...

which logic sould be followed using custom partitioner in map reduce to solve this

java,hadoop,mapreduce,load-balancing,hadoop-partitioning
If in a file key distribution is like 99% of the words start with 'A' and 1% start with 'B' to 'Z' and you have to count the number of words starting with each letter, how would you distribute your keys efficiently?

PHP/JS Progress Bar

javascript,php,jquery,ajax,server-sent-events
I'm trying to make a page which will generate a result-set from a complex database query & php parsing... but that's mainly beside the point... The main point is that this takes a minute or two to complete, and I'm hoping to display a progress bar rather then a generic...

Best way to represent this JSON in Go?

json,go,geckoboard
I am writing an endpoint to return data for Geckoboard, it excepts a format like so: { "item": [ { "value": "274057" }, [ "38594", "39957", "35316", "35913", "36668", "45660", "41949" ] ] } "item" is an array of varying structures. How would I represent this data in Go? Note:...

Null entities in DDD

c#,null,domain-driven-design,nullable
Take an example of a Product entity or aggregate which has a reference to another entity called Category. Before a domain event like CategorizeProduct happens, the Category's state is empty. To represent that in C#, I have to use NULL. I can't use Nullable<T> in C# because that can be...

Updating UI for JTextArea in Java

java,swing,user-interface,jtextarea
I'm a beginner and I've hit a bump in the road. The problem I have is that my JTextArea is not updating as my program is running. I ran a command line to see whether the value of the JTextArea is changing. It turns out that it is but on...

Facebook stats: Does querying multiple URLs count as one API request?

json,facebook
I've found a couple of ways to get Facebook stats for a given URL. Both of these work - I'm not sure if one is preferred: https://api.facebook.com/method/links.getStats?urls=http://www.stackoverflow.com&format=json https://api.facebook.com/method/fql.query?format=json&query=SELECT%20url,like_count,share_count%20FROM%20link_stat%20WHERE%20url%20=%20(%27http://www.stackoverflow.com/%27) We run this on a cron that checks all recent content. We've done a fair amount of experimenting with when to stop...

Powershell Script to compare VolumeID to DriveLetter

powershell,volumes,drive-letter
I have a powershell script running wbadmin with source C: to a target iSCSI volume which is specified by its volume ID (\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}). The backup itself runs perfectly fine, I just wanted to add an offsite-backup functionality to the script. Sadly, robocopy cannot use the Volume ID as source for...

Environmental variable is empty into shell script but not in shell

android,bash,shell,sh,libvlc
A shell script checks some of my environmental variables, but this code: if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then echo "You must define ANDROID_NDK, ANDROID_SDK before starting." echo "They must point to your NDK and SDK directories.\n" exit 1 fi prints out You must define ANDROID_NDK, ANDROID_SDK before...

require(footer.php): failed to open stream: No such file or directory in example.php on line [closed]

php,require
Fatal error: require(): Failed opening required 'footer.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\extjskanala\registration.php ...

stop div after the floating div from wrapping text

html,css,css-float
I have trouble with floats. see http://jsfiddle.net/hhbjf2wv/4/ <div> <div style="float:left; width:20px;"> <input type="checkbox"> </div> <div> Just some long long long text Just some long long long textJust some long long long textJust some long long long textJust some long long long text Just some long long long text Just some...

How to incement row id with identity to off

sql,.net,sql-server,stored-procedures,rdbms
I am getting this error while i do select. DECLARE @TopID INT SELECT @TopID = MAX([QuestionId]) from [SurveyQuestions]; SELECT @TopID = @TopID + 1 ,[questiontext] ,[DeptID] ,[SurveyID] FROM [SOSS].[dbo].[SurveyQuestions] where surveyid =80 A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations. I...

How do I chain execution two indepentent Observables serially without nesting the calls?

java,rx-java
Using RxJava I have an Observable<A> and an Observable<B>. I want to start subscription on B as soon as the first (and only) element of A is emitted. I know I can chain it like this: final Observable<A> obsOfA; final Observable<B> obsOfB; obsOfA.subscribe(new Action1<A>() { @Override public void call(A a)...

multiBarChart (nvd3) in rCharts is not displaying

javascript,r,bar-chart,rcharts
I am using rChart library for generating javascript plots directly from R statistical package. I am trying to compute multiBarChart but the plot seems to be blank. EDIT What is more, none of examples from here displays on my computer: https://github.com/ramnathv/rCharts/blob/master/inst/libraries/nvd3/examples.R all examples are blank. Also some1 has a similar...

Links are not fully working after adding active class with php

php,localhost,anchor
I'm using php to add active link state to my navigation menu which is shared dynamically across all my website pages. But when I go to other links from homepage it works fine but when I go back to homepage its give me "object not found" error. <!--start vertical menu-->...

install4j: Different installation paths for different components

install4j
I have 2 installation components, and I need them to be installed in different locations (and the user should be able to change them), but the installer only ask for one path for both. Is there any simple way to change that or should I create custom forms?...

Apple ID not found - In-App Purchase iOS 8

ios,xcode,cocoa-touch,ios8,in-app-purchase
I'm at the stage of testing an "in app purchase" on my iPhone 6+ running 8.1.3. Basically, you click the "no ads" button which takes you to a new ViewController which handles buying and restoring the purchase. I followed Geeky Lemons tutorial on Youtube. For some reason, every time I...

Double not parsing correctly when high enough

c#,double,exponential
I have a visitors count in my website and I'm trying to save it as Double instead of Integer because it allows higher numbers. The thing is that when the count is too high, for instance 300,000,000,000,000,000,000,000, it gets saved as 3.0E+23. How can I possibly parse this number to...

How to get distinct values from PyMongo

mongodb,python-2.7,pymongo
In MongoDB I have a dataset of store data. Using PyMongo I am finding all of the distinct/unique values in a collection for testy in collection.distinct('stores'): print(testy) I can also find a subset of badly spelt stores I'm interested in for testy in collection.find({'stores': {'$in': ['Aldi','ALDI','aldi']}}): What I want to...

Split file and turn it into dictionary in python

python,python-2.7,dictionary,split
counts = dict() for word in x: # x is file named "f2.txt" words = word.split() print words counts[words] = counts.get(words,0) + 1 print counts I want to split a file and then want to print the words which is used maximum times. But I am not even able to...

C# - Not being able to use list.Count() in this scenario

c#,list,count,compiler-errors,protection
I've been getting this error during compile: System.Collections.Generic.List<string>.Count is inaccessible due to its protection level about trying to use the method Count() on a list I created that represents an inventory in my project. The list itself is public so I can't get my head around as to why this...

Difference between malloc() and simple declaration in fixed sizes [duplicate]

c,double,malloc,difference
This question already has an answer here: Difference between declaration and malloc 8 answers Let assume that I want to get space for an array of x double, x being an integer. Can someone explain me the difference between double myArray[x]; and malloc(x*sizeof(double)); excepted the fact that malloc() returns...

Android Bluetooth- MAC address

java,android,bluetooth,android-bluetooth
I am trying to get the MAC address of a bluetooth device when I click on a device in the listview. I want to pass in the MAC address in BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); Is there a way I can extract the MAC address when I choose a device on...

Using D3 to draw background gridline paths in a matrix for scatterplots?

javascript,d3.js,path,line,scatter-plot
I've been able to draw most of the visual components of a scatterplot. I now want to draw some background gridlines using a lighter color. In other words, every X coordinate will have a corresponding vertical background gridline that goes the full height of the Y axis and every Y...

MongoDb Access array of objects with certain property

arrays,mongodb,mongodb-query,aggregation-framework
I have one document as follows: { user: 'hvt07', photos: [ { link: 'http://link.to.com/image1.jpg', isPrivate: true }, { link: 'http://link.to.com/image2.jpg', isPrivate: false } ] } I want to get all photos which are with: isPrivate: false I am using the following query: db.collection_name.find({ photos:{ $elemMatch:{isPrivate: false} } }).pretty() I have...

Representing a class diagram using protege

sparql,ontology,class-diagram,protege
I'm developing an ontology for a searching laboratory and I need to represent my class diagram with "Protege". I don't know how to represent relations cardinals. How can I do it for this one for example? And what about the cardinals : 0...* 2..5 3..* 0..1 etc Thank you very...

Download pdf from href link issue

php,wordpress,pdf,download
I am working on a wordpress. I make a meta field for upload pdf file,pdf file upload sucessfully. Now i call meta value in href link for download the pdf file.But the problem is that it can open the file but not download.For this i search a code that is...

Linkedin Oauth Javascript authorization “uh oh!”

javascript,oauth,linkedin
I can't login on my app with Linkedin, i see modal linked dialog with "uh oh!" What to do? Why don't work linkedin Oauth? function onLinkedInLoad() { IN.Event.on(IN, "auth", function() {onLinkedInLogin();}); IN.Event.on(IN, "logout", function() {onLinkedInLogout();}); } function onLinkedInLogin() { IN.API.Profile("me") .fields(["id", "firstName", "lastName", "pictureUrl", "publicProfileUrl", "emailAddress"]) .result(function(result) { console.log(firstName); })...

How to get the selected date from android TimeSquare library?

java,android,android-view,android-calendar,android-time-square
How to get user selected date from android TimeSquare library? I used getselectedate() but it didn't work and OnClickListener also not working with this. public class HomeActivity extends Activity { private String dateHolder; private CalendarPickerView calenderView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); calenderView = (CalendarPickerView) findViewById(R.id.calendar_view); calenderView.init(lastYear.getTime(), nextYear.getTime())...

Make a playlist (start next song) in swift

ios,swift,avfoundation,avaudioplayer,playlist
I have created a sound player in swift with AVFoundation. I am trying to start the next song in array when the playing song is finished. I was trying to implement this code if (audioPlayer.currentTime >= audioPlayer.duration){ var recentSong = songPlaylist[selectedSongNumber + 1] audioPlayer = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource(recentSong, ofType: "mp3")!),...

How does XML transform work in Scala

xml,scala
I am looking for an application bug, which makes scala.xml.BasicTransformer run in infinite loop. First of all, I am reading BasicTransformer.scala to figure out how transform (see below) works: abstract class BasicTransformer extends Function1[Node, Node] { // ... protected def unchanged(n: Node, ns: Seq[Node]) = ns.length == 1 && (ns.head...