Using Firebase, how would I make a page where a user can manipulate data, save it, log out, log back in, then come back to that same data?

Uncategorized
Question: I am using Firebase, and I've already made a login application. What I want to do, is, after a user registers and logs in, they'd be redirected to a new page. Example: window.location = 'loggedIn.html'; On that page, we'd have something like a simple button counter. You click the button, and a number increases by one. (Example, something like this: http://jsfiddle.net/Dfprp/) After they're done, they'd submit their data (I already have this part done) and log out. HOWEVER Once they log back in, I want them to have the same saved data as they had before. So if they log in, increment the number by 10, submit and save, logout, log back in, they'd have their saved 10 count increment. I hope this makes sense. Answer: Read more
Read More

Absolute – Real Estate & Property Sales Responsive Template

Uncategorized
Absolute is a modern Real Estate and Rental HTML5 Template. It allows you to create your own real estate business website easily. It is build upon Bootstrap framework to offer best customizability and development experience. Absolute template comes with ready to use layouts for different real estate directions such as real estate agency, property rental, single property, realtor website, properties listing, real estate broker, properties directory and other. Absolute property listing provides multiple property listing variations such as list view, grid listing and map listing.
Read More

Socket.io with Redis

Uncategorized
Question: what is the difference between socket.io-redis and socket.io-emitter? do i need both? on the documentation, it says i first need to create a redis adapter:var io = require('socket.io')(3000); var redis = require('socket.io-redis'); io.adapter(redis({ host: 'localhost', port: 6379 })); followed immidiately by saying i can then emit messages with:var io = require('socket.io-emitter')({ host: '127.0.0.1', port: 6379 }); setInterval(function(){ io.emit('time', new Date); }, 5000); there is an example of socket.io-redis connecting to redis an also emitting events: https://github.com/h4t0n/socket.io-redis-appsample/blob/master/app.js Answer: Read more
Read More

Call node.js function on insert in Sql Server

Uncategorized
Question: I'm using Sql server and i have a function in node.js that i want to be executed everytime a new row is inserted in the specific table. This is the code that i want to be run when a change is made in the table. private sql = require('mssql'); private currentID: any; `private config = { user: 'sa', password: 'sa', server: '192.168.100.2', port: '1433', database: 'test1', connectionTimeout: 100000,}; ` public checkDatabase() { this.sql.connect(this.config).then((connection: any) => { new this.sql.Request(connection).query('SELECT EventID FROM Events ORDER BY EventID DESC').then((recordset: any) => { console.log(recordset.recordset[0].EventID); if (this.currentID == recordset.recordset[0].EventID) { console.log("They are the same " + this.currentID + " " + recordset.recordset[0].EventID); } else { console.log("Not the same " + this.currentID + " " + recordset.recordset[0].EventID); } this.currentID = recordset.recordset[0].EventID; }); }); } Any suggestions…
Read More

Impala+hbase+hive-hbase.security.AccessDeniedException

Uncategorized
Question: Using Sqoop Migrated a table from MySQL to Hbase. Created External table in Hive. Can able to read records from Hive shell. But when tried with Impala shell I am getting the following exception. I checked grant privileges for table in Hbase it has all RWCA access to the user. but still getting exception when accessed from Impala shell. Any kerberos Authentication needed ? what the issue? how to resolve? AccessDeniedException: org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions for user 'impala' (table=namespace.tablename, action=READ) at org.apache.hadoop.hbase.security.access.AccessController.internalPreRead(AccessController.java:1611) at org.apache.hadoop.hbase.security.access.AccessController.preScannerOpen(AccessController.java:2080) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$50.call(RegionCoprocessorHost.java:1300) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionOperation.call(RegionCoprocessorHost.java:1673) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1749) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperationWithResult(RegionCoprocessorHost.java:1722) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preScannerOpen(RegionCoprocessorHost.java:1295) at org.apache.hadoop.hbase.regionserver.RSRpcServices.scan(RSRpcServices.java:2408) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33648) at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2182) at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112) at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:185) at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:165) CAUSED BY: RemoteWithExtrasException: org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient permissions for user 'impala' (table=nrd_app_spt:capacity_new, action=READ) at org.apache.hadoop.hbase.security.access.AccessController.internalPreRead(AccessController.java:1611) at org.apache.hadoop.hbase.security.access.AccessController.preScannerOpen(AccessController.java:2080) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$50.call(RegionCoprocessorHost.java:1300) at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionOperation.call(RegionCoprocessorHost.java:1673) at Answer: Read more
Read More

Kernel dead running a simple average operation using Python

Uncategorized
Question: I am running a simple average operation over three columns. I am transforming the monthly data into a quarterly average. The data looks like this: 2000.1 2000.2 2000.3.... 18 15 27 I want to transform it into 2000.q1 20 Here is what I have so far: def convert_housing_data_to_quarters(): '''Converts the housing data to quarters and returns it as mean values in a dataframe. This dataframe should be a dataframe with columns for 2000q1 through 2016q3, and should have a multi-index in the shape of ["State","RegionName"]. Note: Quarters are defined in the assignment description, they are not arbitrary three month periods. The resulting dataframe should have 67 columns, and 10,730 rows. ''' # read in the zillow housing data zillow_df = pd.read_csv('City_Zhvi_AllHomes.csv') print(zillow_df.iloc[1,1]) print(len(zillow_df)) # slice from 2000q1 to 2016q3…
Read More

could not update data through foreach loop

Uncategorized
Question: i want update the stock and minus girdtempsale data from grid stock through foreach loop when i press confirm button is that code right [1]: https://i.stack.imgur.com/QkrOM.png "tooltip" SqlCommand cmd = new SqlCommand("update tbl_stock set TotalQuantity=@tq,TAmount=@ta where ItemId=@id", d.con); d.con.Open(); foreach (DataGridViewRow row in datagridsale.Rows) { cmd.Parameters.Clear(); string f = row.Cells[datagridsale.Columns["TotalQuantity"].Index].Value.ToString(); string g = datagridtempsale.CurrentRow.Cells["ItemQuantity"].Value.ToString(); string h = row.Cells[datagridsale.Columns["TAmount"].Index].Value.ToString(); string i = datagridtempsale.CurrentRow.Cells["TotalPrice"].Value.ToString(); int x=(int.Parse(f)-int.Parse(g)); decimal y=(decimal.Parse(h) - decimal.Parse(i)); cmd.Parameters.AddWithValue("@tq", x); cmd.Parameters.AddWithValue("@ta", y); cmd.Parameters.AddWithValue("@id", row.Cells[datagridsale.Columns["ItemId"].Index].Value.ToString()); cmd.ExecuteNonQuery(); } d.con.Close(); Answer: Read more
Read More

How alter the text shown by pdf.js?

Uncategorized
Question: I'm not trying to modify the PDF, I'm just trying to change the displayed text pdf.js outputs text it reads in a bunch of divs .textLayer > div, it also draws a canvas I read here that viewing and editing pdf in the browser is almost impossible, but... Since pdf.js does have an API, my idea is to "hook" into pdf.js and change the displayed text (that's more than enough in my case) The closest I could find is this function named _getTextContent(), but there are no callback registered AFAICS. Is this even possible (without messing with pdf.js itself)? If so, how? EDIT I did try to manipulate the DOM (specifically the .textLayer > div I mentioned earlier), but pdf.js uses both DIVs and canvas to do its magic,…
Read More

Cordova 7.x app crashes on older Android devices (Samsung Note 4/ Samsung S5..)

Uncategorized
Question: I have an application built using Cordova 7.x/AngularJS 1.x which has some functionality to take a picture using the camera - this all seems to work on my new Android device (less than 12 months old) but on older devices such as Galaxy Note 4 & Galaxy S5 it seems to struggle after a few minutes of usage and close the app. I have viewed the android abd logcat and can see the following :- 17:42:28.731 16736-16915/com.abc.abc.123 A/chromium: [FATAL:memory.cc(19)] Out of memory. size=63492096 17:42:28.731 16736-16915/com.abc.abc.123 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 16915 (CompositorTileW) 17:42:29.951 16736-16736/com.abc.abc.123 I/Choreographer: Skipped 70 frames! The application may be doing too much work on its main thread.* Clearly the out of memory is an obvious problem but as I am using the…
Read More

error TS2307: Cannot find module ‘@angular/common/http’ for HttpClientModule

Uncategorized
Question: I am trying to import HttpClientModule using the following line in my app.module.ts: import { HttpClientModule } from '@angular/common/http'; and imports: [ ... HttpClientModule, ... ] However I keep getting the same error: src/app/app.module.ts(4,38): error TS2307: Cannot find module '@angular/common/http'. Despite those exact lines being included in these tutorials: https://angular.io/guide/http https://medium.com/codingthesmartway-com-blog/angular-4-3-httpclient-accessing-rest-web-services-with-angular-2305b8fd654b http://blog.ninja-squad.com/2017/07/17/http-client-module/ How can I fix this and use HttpClient ? Answer: The new http client was only added in the 4.3 version. You're probably using older angular version. You need to update the project. Go into package.json and modify all @angular/... entries to include ^4.3.4 version. Also see Difference between HTTP and HTTPClient in angular 4? Read more
Read More

Random string condition in Java

Uncategorized
Question: I don't understand how program finished where I couldn't see when the count have increased? and get false to terminate program? private String[] array = {"hello", "hi", "what is your name"}; private String getRandomCharacter() { return array[random(array.length)]; } private int random(int length) { return new Random().nextInt(length); } protected Word_generator() { boolean running = true; int count = 0; int max = 200; while (running) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 1; i++) { sb.append(getRandomCharacter()); System.out.println(); System.out.println("Word-->"); } System.out.println(sb.toString()); if (count++ == max) { running = false; System.out.println("finished"); } } } public static void main(String[] args) { new Word_generator(); } Answer: The value of count is being increased at this line if (count++ == max){...} Here, first of all count is checked whether…
Read More