on-internet

How can I generate a unique random number at each row of record?

I'm using SQL Server 2000. I'd like to generate random number without repetition at each row. However, my code is not working. I tried many times but I cannot fix the repetition problem. My code as below: I used "case" to handle duplicate number but it does not work. Can anyone help me? DECLARE @index INT ,@ran_no INT ,@counter INT ,@i INT SET @i = 1 WHILE @i <= 18 BEGIN SELECT @index = count(basket_seq) FROM dbo.test WHERE basket_seq = @i AND flag = 'left' BEGIN UPDATE dbo.test SET @ran_no = convert(INT, 1 + @index * RAND(CHECKSUM(NEWID()))) ,@ran_no = ( CASE WHEN convert(INT, 1 + @index * RA

Join the discussion →

How to test the method that reads the data from the excel file in java?

The above picture shows the excel file containing the Facebook data. The class FacebookDataExtraction reads the data from the Excel file and stores the data as list of row objects as shown in the code. I have made use of the config.properties file to get the file path. The contents of config.properties file are: FILE_NAME=D:/Refreshed_data_daily/all_hue_posts_in_excel.xlsx. public class FacebookDataExtraction { //private static final String FILE_NAME="D:/Refreshed_data_daily/all_hue_posts_in_excel.xlsx"; private static final String SHEET_NAME="nextv54plus_actions"; XSSFWorkbook workbook; publi

Join the discussion →

How to retrieve all kinds of dates and temporal values from text

I wanted to retrieve dates and other temporal entities from a set of Strings. Can this be done without parsing the string for dates in JAVA as most parsers deal with a limited scope of input patterns. But input is a manual entry which here and hence ambiguous. Inputs can be like: 12th Sep |mid-March |12.September.2013 Sep 12th |12th September| 2013 Sept 13 |12th, September |12th,Feb,2013 I've gone through many answers on finding date in Java but most of them don't deal with such a huge scope of input patterns. I've tried using SimpleDateFormat class and using some parse() functions to check if

Join the discussion →

Redirect 301 adicionando muitas "/"s no final

Estou enfrentando o seguinte problema com a combinação de mais de um .htaccess em meu projeto. Tenho a seguinte estrutura siteprincipal.com.br (não é WordPress) e dentro um subdominio com um outro site em WordPress site2.siteprincipal.com.br o site2 está dentro de um diretório no public_html, onde o site principal roda tenho dois .htaccess na seguinte estrutura public_html (siteprincipal) |--.htaccess |--site2 (wordpress) |--.htaccess quando faço um redirect de uma url do siteprincipal para o site2, como por exemplo Redirect 301 /paginainterna/ http://site2.siteprincipal.com.br/paginainterna o

Join the discussion →

Request Timed out with Code=-1001_kCFStreamErrorCodeKey=-2102

Sometimes network request from my app gets stuck, And I get the following error after a while, failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."UserInfo={NSUnderlyingError=0x1390937f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://apis.xyz.xyz.com, NSErrorFailingURLKey=https://apis.xyz.xyz.com, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.} Any request I make after this, The same sent req

Join the discussion →

How to make a Materialize Jumbotron

I am trying to build a sign up page like this one Sign up page I checked the source code, its using angular material design. So couldn't figure out on how to do this using Matrialize.css itself. It is similar to a Jumbotron in bootstrap. But I guess its implementation is not as simple as it was in bootstrap. I suppose that this is done using cards in Materialize. But I am not being able to produce or replicate the same thing. Can anyone shed light on how to use cards properly in Materialize. Thank You

Join the discussion →

Erlang machine stopped instantly (distribution name conflict?). The service is not restarted as OnFail is set to ignore

I am using RabbitMQ. For some reason the rabbitMQ service stops as soon as you start it. I saw following error in the event log: RabbitMQ: Erlang machine stopped instantly (distribution name conflict?). The service is not restarted as OnFail is set to ignore. Someone told me to run this command: erl -sname rabbit This command generates following output: {(no error logger present")i neirtr otre: r"mEirnraotri nign ipnr odcoe_sbso o< t0".,2{.b0a>d awrigt,h[ {eexrilt_p rviaml_uleo:a d{ebra,dcahregc,k[_{feirlle__pr reismu_llto,a3d,e[r{,fcihleec,k"_efrill_e_prreismu_llto,a3d,e[r{.feirlle",}\,"{e lr

Join the discussion →

S3 Cross Account Notifications

It is possible to send S3 events from Account A to an SQS queue in Account B. But, the only way I have been able to achieve this is by opening the permissions for the sendMessage action in SQS to allow everyone access. Is it possible to configure S3 events to sendMessage to a different account with some permission restrictions in place on the SQS queue? For example, if I try to restrict access to a specific account (e.g. 123456789012, I receive an error in the S3 console when I try to save the event: Unable to validate the following destination configurations : Permissions on the destination q

Join the discussion →

How to perform a range query over AWS dynamoDB

I have a AWS DynamoDB table storing books information, the hash key is book id. There is an attribute for book price. Now I want to perform a query to return all the books whose price is lower than a certain value. How to do this efficiently, without scanning the whole table? The query on secondary-index seems only could return a set of entries with the index being a certain value, so I am confused about how to perform a range query efficiently. Thank you very much!

Join the discussion →

facebook User request limit reached

We are getting the below issue when querying facebook graph API (#17) User request limit reached i know that this is a throttling error on user level rate limiting as mentioned in the below link https://developers.facebook.com/docs/marketing-api/api-rate-limiting But we were never facing the issue before, suddenly this issue has started coming, Did facebook changed the rate limits recently ? does anybody have any idea ?

Join the discussion →

The binding status was "DT_NTEXT". The data flow column type is "DBBINDSTATUS_UNSUPPORTEDCONVERSION"

I have the following query in Access: SELECT Field1, Field2, Field3, "2015" As TestYear FROM Table1 I use this query in SQL Server Import/Export tool to get data from Access database into SQL Server database. I keep getting an error: "(SQL Server Import and Export Wizard) Error 0xc002f446: Data Flow Task 1: An error occurred while setting up a binding for the "TestYear" column. The binding status was "DT_NTEXT". The data flow column type is "DBBINDSTATUS_UNSUPPORTEDCONVERSION". The conversion from the OLE DB type of "DBTYPE_IUNKNOWN" to the destination column type of "DBTYPE_WVARCHAR" might no

Join the discussion →

selenium webdriver url navigation (on microsoft edge with window10) , hang after 28/29th url

I have been doing URL navigation ( list of URL in a file ) using selenium webdriver for microsoft edge browser on window 10 machine. I have written automation script in python. code snippet : driver = webdriver.Edge() driver.set_page_load_timeout(60) for url in list_of_url: #100 url print "navigating url :",url driver.get(url) So after navigating 28th url, Script got hanged on 29th URL on "driver.get(url)" line ,and never return. I have also tried with different list of urls, the behavior is same, got hanged on 29th url. Pls look into this issue.

Join the discussion →

counterup the numbers with setInterval (jQuery)

I'm trying to counter up the numbers defined in data attribute with set interval. My code is here. $( ".number" ).each(function(index) { var INCREMENT = $(this).data('increment'); var START_VALUE = 0; var count = 0; count = INCREMENT; $(this).html(count); window.setInterval( function(index){ count += INCREMENT; $('.number').html(count); }, 1000); }); I'm able to get the numbers initially, but with setInterval, all using the first number in the array. WORKING FIDDLE

Join the discussion →

com.amazonaws.AmazonClientException: Unable to execute HTTP request: peer not authenticated

I created a new account on amazon aws to use s3 bucket and I've written this code to upload one image file to s3 bucket but it gives me this exception: >Unable to execute HTTP request: peer not authenticated. This is my main method: public class Main2 { public static void main(String[] args) throws IOException { File file=new File("C:\\Users\\KDSss\\OneDrive\\Pictures\\my photo 001.jpg"); try { InputStream targetStream = new FileInputStream(file); S3Upload.uploadImage(targetStream, "Discussion", "jpg"); } catch (FileNotFoundException e) { e.printStackTrace(); } } } And this is my S3Upload.java

Join the discussion →

Error: Channel ended, no reply will be forthcoming

i'm trying to use wascally (npm) inside a meteor application and i've got it set up and running. however, i'm trying to use the request() function and chain then() statements on to it to deal with a response. i'm getting an error that i can't seem to figure out because i don't even see a message going into my queue. i've set up rabbitmq via cloneamqp.com so i am pretty sure it's not the actual rabbitmq install that's messed up... it's something to do with me. here is my stack trace W20150925-00:14:05.787(-4)? (STDERR) throw e; W20150925-00:14:05.787(-4)? (STDERR) ^ W20150925-00:14:05.789(-4)?

Join the discussion →

How to write a file path that will point to a directory?

How to write a file path that will point to a directory. From what I have googled, /path means root, ./path means current directory, ../path means parent directory I am playing with Framer.js + Yeoman. If you look at the screenshot attached: myLayers = Framer.Importer.load("../imported/test1") is not working? When I put the "imported" folder under the "app" folder it is working.

Join the discussion →

Session not updating after some ajax call requests

I am updating a session using an ajax call. PHP public function mymethod() { //Session Increament $addrowcount=1; $addrowcount +=$this->session->userdata('row'); $this->session->set_userdata('row', $addrowcount); echo $addrowcount; } jQuery jQuery.ajax({url: "myurl.com/mycontroller/mymethod/",dataType: "json", async: false, success: function(data){}}); But the session is not updating or not getting increased after 20 to 23 ajax calls.

Join the discussion →

Nginx : detect mobile and forward to desktop

I have a problem i want to detect the domain and the device and forward the response to the desktop, www server section of nginx. With a rewrite this is done but the problem is the url, is cleared and substitute with my url, the configuration is the following : server { listen 80 default_server; #this detects any domain server_name ~^(www\.)?(?<domain>.+)$; root /home/someone/main; index index.html index.htm; set $mobile_rewrite do_not_perform; # this regex string is actually much longer to match more mobile devices if ($http_user_agent ~* '(iPhone|iPod|iPad|Android|BlackBerry|webOS|Windows Ph

Join the discussion →

Copy the content of one HTML table into another using JavaScript Revisited

I'm teaching myself JavaScript and I need to copy one table into another. I've been able to reproduce @Gushiken's code and @Quentin's response with this example: HTML: <button onclick="copytable()">Copy Table</button> <br /> <br /> <table id="TableA"> <!--<tbody></tbody>--> </table> <br /> <table id="TableB" style="border:solid"> <thead> <tr> <td id="col1">Column 1</td> <td id="col2">Column 2</td> <td id="col3">Column 3</td> </tr> </thead> <tbody> <tr> <td>Data a</td> <td>Data b</td> <td>Data c</td> </tr> </tbody> </table> <br /> JavaScript: function copytable() { var source = document.getElem

Join the discussion →

Mocha: Uncaught AssertionError: expected 200 to be 404

I am trying to test random urr. Which doesn't exits. So response code should 404 but it is returning 200, Which makes test case fail, Till here fine But it is giving Uncaught AssertionError: expected 200 to be 404 How to handle this uncaught Assertion error. it("Should return 404 when you put random url after /api/random", function(done){ server .post("/api/random") .expect(404) .end(function(err, res){ res.status.should.equal(404); done(); }) }); Uncaught AssertionError How to handle this .. Uncaught AssertionError: expected 200 to be 404 + expected - actual -200 +404 at Assertion.fail (node_

Join the discussion →

Android - get imageView XY coordinates

I need to know XY coordinates of an ImageView. This coordinates will be used to position a new ImageView on an RelativeLayout overlay that should have the same position of starting ImageView. Summerize: 1) ImageView1 = getcoordinates XY 2) button click 3) Overlay RelativeLayout that cover entire window. ImageView1 will be behind this RelativeLayout overlay 4) Create ImageView2 in RelativeLayout overlay that should be positioned exactly on ImageView1 Any help? Thanks

Join the discussion →

Package management in Git for Windows (Git Bash)?

I'm reading the github wiki for git-for-windows and it says that msys2 bundles pacman: https://github.com/git-for-windows/git/wiki/Package-management But when I invoke it I get: $ pacman bash: pacman: command not found Does anyone have an idea what is going on? Which git version does this wiki refer to? Is there a way to install additional packages to msys2 inside Git for windows?

Join the discussion →

Gradle fails to download external dependency from local artifactory which should be downloaded form mavenCentral

My gradle build fails due to an error from artifactory: FAILURE: Build failed with an exception. * What went wrong: Could not resolve all dependencies for configuration ':PublishService:compile'. > Could not resolve org.geotools:gt-wfs:9.0. Required by: infraview_gradle:PublishService:0-SNAPSHOT > net.infraview:infraview_context:0-SNAPSHOT infraview_gradle:PublishService:0-SNAPSHOT > net.infraview:infraview_srv_masterdata:0-SNAPSHOT > Could not HEAD 'http://beast:8082/artifactory/libs-snapshot-local/org/geotools/gt-wfs/9.0/gt-wfs-9.0.pom'. Received status code 409 from server: Conflict The geo

Join the discussion →

Keycloak retrieve custom attributes to KeycloakPrincipal

In my REST service I can obtain the principal information after authentication using KeycloakPrincipal kcPrincipal = (KeycloakPrincipal) servletRequest.getUserPrincipal(); statement. Keycloak principal doesn't contain all the information I need about the authenticated user. Is it possible to customize my own principal type? On the keycloak-server-end, I've developed a user federation provider. I saw that UserModel makes possible to add a set of custom attributes to my user. Is it possible to insert my custom principal in that code? Is it possible to retrieve this attributes from keycloak princ

Join the discussion →

C# sort datagridview on column header click

:) I have a datagridview and I fill it by List (I get data from 2 text files), but when I tried to click on a column header (I tried with all columns headers), I can't sort my datagridview data. This is my code: public class Data1 { public string Campionato { get; set; } public string Data { get; set; } public string Home { get; set; } public string Away { get; set; } public int HSFT { get; set; } public int ASFT { get; set; } public int HSHT { get; set; } public int ASHT { get; set; } public int HSSH { get; set; } public int ASSH { get; set; } } public class Data2 { public string Home { get;

Join the discussion →

npm: How to install all dependencies at once

I installed eslint and when running command npm run lint then every time it asks to install all dependencies one by one. Is there any command option to install all once rather than running npm run lint all the time? package.json { "private": true, "devDependencies": { "gulp": "3.9.0", "laravel-elixir-livereload": "1.1.2", "babel-eslint": "4.1.1", "eslint": "1.3.1", "eslint-config-airbnb": "0.0.8", "eslint-plugin-react": "3.3.1", "laravel-elixir-eslint": "1.0.0" }, "dependencies": { "laravel-elixir": "3.2.6", "bootstrap-sass": "3.3.5", "jquery": "2.1.4" }, "scripts": { "lint": "./node_modules/.

Join the discussion →

android - cursor didn't have _data column not found

When run below code to query a file on sdcard, I always get a null. public String getRealPathFromURI(Context context, Uri uri) { String fileName="unknown"; if (uri.getScheme().toString().compareTo("content") == 0) { Cursor cursor = context.getContentResolver().query(uri,null,null,null,null); if (cursor.moveToFirst()) { Log.e(TAG, "dump cursor:" + DatabaseUtils.dumpCursorToString(cursor)); int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); String name = cursor.getString(column_index); if (name != null) { uri = Uri.parse(cursor.getString(column_index)); fileName = uri

Join the discussion →

Entity Framework, not mapped property in query

I'm creating an entity model in which I want to put a not mapped properties. These properties are there to simplify access to values from relationship. Model shown is just a simple example. In users_roles entity, named UserRole, I want to have UserName property and RoleName. public class UserRole { public int Id { get; set; } public int IdUser { get; set; } public int IdRole { get; set; } public User User { get; set; } public Role Role { get; set; } [NotMapped] public string UserName { get { return User.Name; } } [NotMapped] public string RoleName { get { return Role.Name; } } } It's important

Join the discussion →

laravel 5 Authentication always returns false

I have tried everything, I really don't know where I am going wrong but everytime I log in, it returns false. Here is the method to store users in the db: public function store(CreateUserRequest $request) { $user = new User(); $password = str_random(10); $password_hash = bcrypt($password); $new_user = $user->create([ 'first_name'=>$request->input('first_name'), 'last_name'=>$request->input('last_name'), 'email'=>$request->input('email'), 'fone_number'=>$request->input('fone'), 'password'=>$password_hash ]); $new_user->permissions()->create(UserPermission::$default); //send email to the user Ma

Join the discussion →
Older stories