back soft

مطالب مرتبط با «using nd» در back soft | نویسنده: استخدام کار

issues with serializing and deserializing avro data using FlinkKafkaProducer / Consumer

Vote count: 0 I am facing some issues while reading / writing Avro data via FlinkKafkaProducer / FlinkKafkaConsumer through Beam. May be missing something very basic stuff. Will add the code in following posts. It would be great if someone can point to working example of FlinkKafkaProducer and Consumer using Avro schema (NOT using confluent edition of kafka) A) > BeamKafkaFlinkAvroProducerTest if I use KafkaProducer directly (i.e. call produceSimpleData.. ) , things are working fine (just for testing ) Using FlinkKafkaProducer as UnboundedSource (this is what I should do) (i.e. I call produceAvroData2.. ) with the following steps ... 1) First, if I use >> AvroSerializationSchema schema = new...

ادامه مطلب

Compute flex element width before rendering using JS

Vote count: 0 I have a flex-box with an undefined number of cards inside it. .box { display: flex; flex-wrap: wrap; } .card { flex: 1 210px } I must decide how many cards put inside my box, the number of cards displayed will be the right amount to fill exactly two rows. ===== is a card --------------------- | ===== ===== ===== | | ===== ===== ===== | --------------------- This means, that, with a .box of 630px, I will display 6 cards. (630 / 210) * 2 = 6 To compute the cards number per row I'm using this code: getCardsPerRow() { let listWidth = box.clientWidth let cardsNumber = Math.floor(listWidth / 210) let cardWidth = Math.floor(listWidth / cardsNumber + listWidth % cardsNumber) retu Math...

ادامه مطلب

using flexbox and scaling images and stay on the same line

Vote count: 0 I have the following jsfiddle. Notice how when the images scale, they don't stay on the same line. How can I use flexbox to scale the images so that they stay on the same line as the browser resizes. See code below: http://codepen.io/jasmine1233333/pen/NNBVZe CSS: .npwfu-example-shell { overflow: hidden; min-width: 1100px; max-width: 1920px; margin: 0 auto; width: 100%; box-sizing: border-box; backface-visibility: hidden; } .npwfu-example-shell .example-grid { box-sizing: border-box; width: 100%; margin-left: 80px; transition: transform 0.5s; transition-timing-function: cubic-bezier(0, 0, 0.26, 0.89); will-change: transform; text-align: left; min-height: 360px; display: flex; a...

ادامه مطلب

How to save and load the object's list to SharedPreferences with/without using Gson?

Vote count: 0 In my Android app, I used Gson object in order to save/load the object's Arraylist in SharedPreferences. Follows are my code using Gson. public static ArrayList getModalList(Context ctx) { Gson gson = new Gson(); String json = getSharedPreferences(ctx).getString("ModalList", new Gson().toJson(new ArrayList())); Type type = new TypeToken() {}.getType(); retu gson.fromJson(json, type); } In here "RequestModal" is the simple object include a bit of strings and integers. It works well with the exception of the case "offline". But if inteet is offline, forever works on below code. Type type = new TypeToken>() {}.getType(); How can I solve it? What is the way implement the feature li...

ادامه مطلب

Android UUID v4 using seed

Vote count: 0 I want to have UUID which identifies a device. I use an android id for this String android_id = Settings.Secure.getString(_appActivity.getContentResolver(), Settings.Secure.ANDROID_ID); The issue is to generate UUID v4 from seed. UUID.nameUUIDFromBytes uses version 3. asked 4 mins agoAlex Tonkonozhenko Let's block ads! بخوانید...

ادامه مطلب

How to change the position of My Location Button in Google Maps using android studio

Vote count: -1 I was working on google maps, where i need to change position of My Location(current location button). Presently current location button was top-right position. so please help me how to re-position the current location button on google maps screen. Thanks in advance... my sample code: final GoogleMap googleMap = mMapView.getMap(); googleMap.setMyLocationEnabled(true); asked 1 min agoRamkoti Let's block ads! بخوانید...

ادامه مطلب

Is there a better way to do a find with optional insert using unordered_map of objects with no default constructor?

Vote count: 0 I have the following code: class CEvent { public: CEvent(std::string const&) {} }; std::unordered_map m_messageList; CEvent& GetMessageEvent(std::string const& name) { auto it = m_messageList.find(name); if (it != m_messageList.end()) { auto pair = m_messageList.emplace(std::piecewise_construct, std::forward_as_tuple(name), // Copy-construct 'name' as the key std::forward_as_tuple(name)); // Construct CEvent in-place with the name retu pair.first->second; } retu it->second; } (Live Sample) I think the code is pretty clean, but I don't like that I have to do a find separate from emplace. Is there a way to do this better? Or is this "good enough"? I know I could probably call emp...

ادامه مطلب

Using "extends" inside triangular brackets and a type "T" in Java

Vote count: 0 Part of the code that I'm trying to understand as a begier java student is below: public class StandardGA extends GeneticAlgorithm { private static final long serialVersionUID = 5043503777821916152L; private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StandardGA.class); /** * Constructor * * @param factory a {@link org.evosuite.ga.ChromosomeFactory} object. */ public StandardGA(ChromosomeFactory factory) { super(factory); } /** {@inheritDoc} */ @SuppressWaings("unchecked") @Override protected void evolve() { List newGeneration = new ArrayList(); // Elitism newGeneration.addAll(elitism()); // new_generation.size() < population_size while (!isNextPopulationF...

ادامه مطلب

using xsd.exe to generate c# files from multiple xsd scheme, with the standar UBL 2.0

Vote count: 0 using xsd.exe to generate c# files with the standar UBL 2.0, getting error and waings I have the files This is the command i'm ruing: E:Invoicemaindoc>xsd.exe /c UBL-Invoice-2.0.xsd UBL-CommonAggregat eComponents-2.0.xsd UBL-CommonBasicComponents-2.0.xsd UnqualifiedDataTypeSchemaModule-2.0.xsd UBL-CommonExtensionComponents-2.0.xsd UBL-QualifiedDatatypes-2.0.xsd These are the errors i'm getting: Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.0.30319.17929] Copyright (C) Microsoft Corporation. All rights reserved. Schema validation waing: Type u:un:unece:uncefact:codelist:specification:54 217:2001:CurrencyCodeContentType' is not decla...

ادامه مطلب

Cyclic Dependency when using RelationshipEntity

Vote count: 0 Let's say, i have an User and a Product. The user should be able to rate products and a rating can have a lot of properties like for example a number of stars from 1 to 5. I'd like to have the Product and the User in different Maven modules. However, Product should know its Owner, so there is a dependency to the module, holding User. I also would like to have a Rating-Module that contains everything related to ratings. I constructed the Rating @RelationshipEntity(type="RATES") public class Rating{ private Long id; @StartNode private User rater; @EndNode private Product ratee; @Property private RatingProperty property; //Getter/Setter } Where the RatingProperty contains the int ...

ادامه مطلب

How to insert to DB using only auto-generated values, and return an ID?

Vote count: 0 I use spring framework, and would like to insert a row to DB in order to have its ID, which is needed for further processing. Inserting query is given below, it's a simple query, without parameters. But it's even worse, cause how to construct working call using executeAndRetuKey from SimpleJdbcInsert? This is an SQL query for insert. But I don't know whether is possible to use it within simpleJdbcInsert instance. insert into sdc_import_run(id_import_run, create_date) values(nextval('seq_import_run'),now()) I tried Number genId = simpleJdbcInsert.withTableName("sdc_import_run") .usingGeneratedKeyColumns("id_import_run") .executeAndRetuKey(new MapSqlParameterSource()); It doesn't...

ادامه مطلب

Adding new dependency to package.json in node causing error

Vote count: 0 I am having serever.js file which contains the below code. I am having another package.json file which have dependencies. I later added underscore dependency to the existing dependency. It's throwing error on require("socket.io")(http) as require(...) is not a function. When I run the file using command node server error is coming after adding dependency. var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var http = require('http').Server(app); var io = require("socket.io")(http); package.json "dependencies": { "express": "~3.4.0", "jade": "*", "socket.io": "0.8.x", "logfmt": "~1.1.2", "nodemailer": "~0.7.0", "mongoose": "^4.2.4", "b...

ادامه مطلب

What are the pros and cons to using RubyMotion to build an Android app?

Vote count: -1 I want to lea Ruby, and I want to get more experience doing Android development. Is using RubyMotion a good way to achieve both goals at once? What are the downsides of using RubyMotion? The primary goal is leaing as opposed to other considerations like integrating with an already existing body of Java code, taking advantage of my Java skills, etc. asked 2 mins agoKartick Vaddadi Let's block ads! بخوانید...

ادامه مطلب

Excel VBA: How to select cells using rows and columns

Vote count: 0 I would like to select the range of cells using rows and columns information. The idea is to select entire column and entire row and then make selection of the overlapping areas. Is it possible to do this in Excel VBA? The idea visualized here asked 2 mins agoJoel Kanerva Let's block ads! بخوانید...

ادامه مطلب

How to convert UTC date format provided by SalesForce Api and convert it to local Date and Time format using Google Apps Script

Vote count: 0 I have looked at various solutions posted i.e. parsing, substrings and splitting and none of them either produce a value or the required value. The format received via Salesforce API is "2014-08-19T02:26:00.000+0000" Essentially I would like a custom function that can be used within Google Sheets to convert this date/time format and take daylight saving into consideration Thank you beforehand asked 2 mins agoGadget Let's block ads! بخوانید...

ادامه مطلب

wrong color blend when using subclass of SKSpriteNode, also wrong image edges

Vote count: 0 I want to create a series of different color sprites using a single gray scale image: For example, if I use blue color with blendingMode: .Color in a software (Sketch, AI, etc), I get: Then I create a subclass of SKSpriteNode, use init method like this: init() { let image = UIImage(named: "gem1") // let image = UIImage(named: "gem1")?.imageWithRenderingMode(.AlwaysTemplate) let coloredImage = image?.blendColored(someColor, blendMode: .Color) let texture = SKTexture(image: coloredImage!) super.init(texture: texture, color: UIColor.clearColor(), size: texture.size()) } But I get the sprite like this: Definitely not what I want. When I change the color blend mode to .Multiply I go...

ادامه مطلب

Is there a way to programmatically override remote push notification sounds using Swift?

Vote count: 0 I have a Swift iOS8+ app that receives remote push notifications from a 3rd party server over which I have no control. That server sends push notifications as JSONs with the usual "alert" and "badge", but does not send the "sound". Consequently, my app plays the default alert sound for push notifications. Is there any way to programmatically override the sound, so that I can play my own, custom remote push notification alert sound? Or even programmatically mute the sound? Remember, I caot force the sending server to change the push notification payload to include a different sound. I began by placing the sound file (ding.aiff) in my main bundle, but there seems to be no way of ...

ادامه مطلب

.NET 4.5: Simple option to encrypt a string using logged-in user and machine as encryption key

Vote count: 0 Using C# and .NET 4.5: I am looking for a simple and efficient option to use the windows user and current machine to encrypt/decrypt a string. The encrypted string can be decrypted on the very same machine with the same logged-in user only. Other users logged-in to the same machine must not be able to decrypt. The same user logged into another machine must not be able to decrypt. Back in 2002, I used to use DPAPI to do the similar thing. I expect there is a more mode option in 2016 with .NET 4.5 with single line of API call :) Thank you, asked 39 secs agoAllan Xu Let's block ads! بخوانید...

ادامه مطلب

Pass one value into INSERT statement using SQL CommandBuilder

Vote count: 0 I'm new to VB.Net. I'm using MySqlCommandBuilder to automatically generate Insert and Update queries when some data is changed in a DataGridView. I already have a variable called user_id that stores a numerical value. THIS IS THE GOAL: I want to insert the value contained in the user_id variable into a column called id_usuario in my MySQL Database along with whatever data was inserted in a new row of the DataGridView. Here's my code: or if you prefer Check it here! Imports MySql.Data.MySqlClient Public Class Dashboard Public user_id As String ' This value has been set from another Form it contains the id of the current user Dim coectionstring As String = "Server=REMOVED;user id...

ادامه مطلب

What is the recommended way to require minified versions in production but debug in development when using browserify?

Vote count: 0 I have just started looking at browserify and am wondering what is the recommended way to require the min versions of dependencies when building for production and the debug ones when building for development? For example, I have followed the tutorial here - http://www.sitepoint.com/getting-started-browserify/ and ended up with the following files: jsmain.js var names = require('./names.js'), findSuperman = require('./findsuperman.js'); if (findSuperman(names())) { document.write('We found Superman'); } else { document.write('No Superman...'); } jsnames.js module.exports = function () { retu ['Barry Allen', 'Hal Jordan', 'Kara Kent', 'Diana Prince', 'Ray Palmer', 'Oliver Queen'...

ادامه مطلب