w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to Split / Separate the Data inside the ArrayList and Store to HTML Table?
To start of, everything in java is an Object. First you need to create a object. Lets call it PersonInfo and construct this object with the data that you have. public class PersonInfo{ private String name; private int age; private String address; private int telephone; // add setter/getter below } Lets say you have PersonInfo personInfo while displaying , you can then use personInfo.getName() and so on. Not sure if you want to use List<PersonInfo> list = new ArrayList<PersonInfo>() instead of Map.

Categories : Java

Encrypting Netcat data with OpenSSL
Based on additional information from your comment, install MacPorts, and try to use ported socat or stunnel. dtpwmbp:~ pwadas$ uname -a ; sudo port list |egrep -i socat|stunnel Darwin dtpwmbp 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64 stunnel @4.47 security/stunnel socat @1.7.2.1 sysutils/socat dtpwmbp:~ pwadas$ http://www.macports.org

Categories : Osx

awk search and combine data from 2 separate CSV files
If you goal is to merge both files, then join is the tool you might be looking for. $ join -t , -1 3 -2 2 "File 1" "File 2" That says: uses ',' as field delimiter. For the first file, the field to compare is the third one. For the second file is the second. The first file is "File 1" and second one is "File 2".

Categories : Bash

How to split up data from a column in a csv file into two separate output csv files?
import csv records = [line for line in csv.reader(open('test_input.csv', 'rt'), delimiter=',')] outfile1 = open('test_output1.csv', 'wt') outfile2 = open('test_output2.csv', 'wt') outfileWriter1 = csv.writer(outfile1, delimiter=',') outfileWriter2 = csv.writer(outfile2, delimiter=',') # headers always the same outfileWriter1.writerow(records[0]) outfileWriter2.writerow(records[0]) for record in records[1:]: cat = record[-1].strip() # get category in form "AB" new_record = record new_record[-1] = " %s" % cat[0] # set category for file 1 with tab as a prefix outfileWriter1.writerow(new_record) new_record[-1] = " %s" % cat[1] # set category for file 2 with tab as a prefix outfileWriter2.writerow(new_record) outfile1.close() outfile2.close()

Categories : Python

SVNKit to find diff between two files stored at separate locations with separate revision numbers
Your code looks correct. But prefer using the new API: final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final SvnDiffGenerator diffGenerator = new SvnDiffGenerator(); diffGenerator.setBasePath(new File("")); final SvnDiff diff = svnOperationFactory.createDiff(); diff.setSources(SvnTarget.fromURL(url1, svnRevision1), SvnTarget.fromURL(url2, svnRevision1)); diff.setDiffGenerator(diffGenerator); diff.setOutput(byteArrayOutputStream); diff.run(); } finally { svnOperationFactory.dispose(); }

Categories : Java

Data store in C used by multiple files
Personally, and this really is a personal choice, I would store the data (myproject[]) in its own C file. Why? Because conceptually header files should be for constants (use for compilation, not storage) and definitions. Code files, on the other hand, consist of data and code. Ultimately code files compile down to object files and the linker then joins up references between those object files. Both code and data are items that are referenced so - logically - if your data is in a C file which then becomes an object file it will be referenced by another object file (from a C file). For me the test of whether something can go in a header file is whether two separate C files could include that file and still link. In this case - putting a static variable in a header file would break linkag

Categories : C

Erlang store pool of mongodb connections
Some points to guide you in the correct direction: Erlang has no concept of a global variable. Bindings can only exist inside a process and that binding will be local to that process. Furthermore, Inside a process, there is no process-local bindings, only bindings which are local to the current scope. Note that this is highly consistent with most functional programming styles. To solve your problem, you need a process to keep track of your resource pool for you. Clients then call this process and asks for a resource. The resource manager can then handle, via, monitors what should happen should the client die when it has a checked out resource. The easiest way to get started is to grab devinus/poolboy from Github and look into that piece of code.

Categories : Mongodb

Data-centric application: separate database tables for separate organizations a good idea?
I was wondering whether rather than have a single set of tables, it would be much safer to have a separate set of tables for each client, all running within the same database. If you want to do this, you have a separate set of tables for each client, running in different logical databases. It's easier for the DBAs to manage. You're basically admitting that you can't depend on your application code to keep the firms separate when sharing the same database tables. Since each firm will have around 20-40 tables, will the number of tables tend to explode in magnitude with number of users, thus slowing down the database altogether? You're either going to have 20 - 40 tables for each firm, or 20 - 40 large tables for all the firms. The amount of storage will be about the same either

Categories : Database

Can we use two header files in two separate .mm files in same project in iPhone
You've included same file in your project twice. It's possible that another library (such as sharekit) included it for you, doublecheck the files sharekit includes and remove one copy of that file and things should compile.

Categories : IOS

Store a value in a UI control vs. in a separate variable?
Both approaches work. I personally tend towards the latter scenario (separate variables): Using controls such as a TextBox as the single location that holds your business data is frowned upon by some people. This becomes especially problematic in practice if you have to first parse the value whenever you access it (turning a string representation back into an object), or format it (turning the object into a string representation) when you want to display it. In that case, I would decide to store the actual value separately from the control, so that all the parsing and formatting logic can be concentrated into one place, without having to repeat it all over your codebase. On the other hand, storing values in separate variables introduces the need to keep that variable in sync with the con

Categories : Vb.Net

how to store specific output of ec2din in separate variables
Store the output first on a variable then reuse it on other commands: output=$(ec2din "${instance[n]}" --region "$i") ec2url=$(echo "$output" | grep INSTANCE | awk '{print($4)}') size=$(echo "$output" | grep INSTANCE | awk '{print($9)}') comment=$(echo "$output" | grep TAG | awk '{print($5)($6)($7($8)}') And you could actually just exclude grep and just use awk: output=$(ec2din "${instance[n]}" --region "$i") ec2url=$(echo "$output" | awk '/INSTANCE/{print($4)}') size=$(echo "$output" | awk '/INSTANCE/{print($9)}') comment=$(echo "$output" | awk '/TAG/{print($5)($6)($7($8)}') Another way is to use here strings instead of using echo: output=$(ec2din "${instance[n]}" --region "$i") ec2url=$(awk '/INSTANCE/{print($4)}' <<< "$output") size=$(awk '/INSTANCE/{print($9)}' <<

Categories : Bash

Check if files have same name and store line count of files with same names
Dictionaries are very accommodating for tasks like this. You will have to modify the example below if you intend to recursively process input files at different directory depths. Also keep in mind that you can treat Python strings as lists, which allows you to splice them (this can cut down on messy regex). D = {} fnames = os.listdir("txt/") for fname in fnames: print(fname) date = fname[0:8] # this extracts the first 8 characters, aka: date if date not in D: D[date] = [] file = open("txt/" + fname, 'r') numlines = len(file.readlines()) file.close() D[date].append(fname + " has " + str(numlines) + " lines") for k in D: datelist = D[k] f = open('output/' + k + '.txt', 'w') for m in datelist: f.write(m + ' ') f.close()

Categories : Python

IIS SQL Server: Connection Pool: Why are new connections made instead of reusing existing connections?
If the connections are coming from a different machine, the connections can't be pooled. A connection required both endpoints to be a connection. If you are using connection pooling correctly, applications instantiate a connection (from the pool), use the connection, then drop it as soon as exchange is complete. If you a writing a single-threaded desktop app, another common and simple strategy is to open a connection, and just leave that connection open as long as the application is running. You can control how many connections are created, etc. see MS article for more details related to connection pooling. IIRC, connection pools are not shared unless the connection string is identical either.

Categories : Sql Server

How to store data with abstract type? Is it sane to store data as sql_variant data type?
It's hard to determine right answer from your question. What data types you are expecting to be and what are you going to do with that types? Because,if you are going to create to many tables for each type you will end up in complexity and more size on disk than using sql_variant type. Keep in mind that when using sql_variant to represent boolean, will only represent 1 byte of overhead(for storing data type kind) + variable length bytes(wich you probably already have in table). But if you are using that type fore some complex mission critical logic and if yours data access framework doesn't support sql_variant you should not use sql_variant.

Categories : SQL

how to netcat url with parameters?
The path should be in the request line (the first line) after the method name (GET in this case). Currently you tell nc to look up the hostname www.iana.org/domains/reserved which will fail. Also the "Host" header should not include the path, only the hostname. This should work: printf 'GET /domains/reserved HTTP/1.1 Host: www.iana.org Connection: close ' | nc www.iana.org 80

Categories : Linux

nc (netcat) on Mac OS X 10.8.4 gets stuck
I tried this on my Mac running 10.8.4 and after about 6 minutes it was looking like: andys-MacBook-Pro:EquipDB uw$ for i in {183..200}; do echo "hello" | nc -n -w 2 -v 10.120.113.$i 22; done nc: connect to 10.120.113.183 port 22 (tcp) failed: Operation timed out nc: connect to 10.120.113.184 port 22 (tcp) failed: Operation timed out nc: connect to 10.120.113.185 port 22 (tcp) failed: Operation timed out nc: connect to 10.120.113.185 port 22 (tcp) failed: Operation timed out So it is timing out on mine, but just takes quite a while. Hmmm... was thinking my test would be pointless because I will never actually connect to something since I'm not on your network. But I did see this: -w # => Timeout after # seconds Note that -w also sets the network inactivity timeout. This does no

Categories : Bash

Is it possible to create different connections per client in SignalR? Persistent Connections
You could use my lib for this called SignalR.EventAggregatorProxy Install using nuget Install-Package SignalR.EventAggregatorProxy It takes care of the Hub and connection details for you under the hood, so that you only need to subscribe and publish events Check wiki for how to set it up https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy/wiki Once set up all you need todo to get it to listen to a back end event from javascript is ViewModel = function() { signalR.eventAggregator.subscribe(MyApp.Events.TestEvent, this.onTestEvent, this); }; You can listen to how many events you want on only one connection and one hub

Categories : Javascript

Netcat connection refused
Fixed...turns out the problem was with the netcat listener. By default, the -l command listens for TCP packets. I was sending UDP packets (the -u command). The "connection refused" message stemmed from the fact that the netcat sender did not have anything listening to it on the other machine. Not sure why this is the case, but from my experiments netcat will give you a "connection refused" message if you don't have a netcat listener that receives the packets from your netcat sender. Anyways, the command on the receiving machine that worked was: nc -4ul 10000

Categories : Linux

Netcat web server in windows
Assuming you have a Windows version of nc, it should be possible to accomplish the same thing with this 3 line batch file: :Start (echo HTTP/1.1 200 OK & type index.html) | nc -l 80 goto :Start

Categories : Windows

C# Data Connections Best Practice?
I think it's better to just open them upon the application launching, since you need stuff from your database right?I'm not an expert in this, it's just my opinion... I programmed some similar applications and made the connection at the start of the main form. The only form where i created a separate connection was the login form.

Categories : C#

DB's long-live connections or on-demand connections?
You don't say what database access library you are using (ODBC, ado.net, other?). Opening and closing database connections is a relatively expensive operation. You should be using some sort of connection pooling scheme in your db access framework. A pool of connections is opened for a period of time, and when your app opens a connection it will get handed an already open connection from a pool. That will make it more efficient. Go read about connection pooling for SQL Server

Categories : Sql Server

Is there any way to configure disk store for terracotta BigMemory to remove all data store on service/cache manager start up?
As I understand your question, you want to remove the Index data from BigMemory Go on restart. Whether you can do this or not depends on your persistence strategy. If it is local restartable, BigMemory Go will try to either reuse the index data if the application was shutdown cleanly, or it will recover the indexes if it was shutdown abruptly. So, for a persistence strategy of local restartable, there is no way to avoid rebuilding the data. If your persistence strategy is "localTempswap", then you will not rebuild any data on restart and will lose the application's state. Please see here for more information: http://ehcache.org/documentation/configuration/fast-restart

Categories : Java

run a command conditionally with netcat and grep
How about this? #!/bin/bash netcat -lk -p 12345 | while read line do match=$(echo $line | grep -c 'Keep-Alive') if [ $match -eq 1 ]; then echo "Here run whatever you want..." fi done Replace the "echo" command with the script you want to execute.

Categories : Linux

Bash Parallel processes in Netcat -c
It should probably be enough to redirect the output streams (to /dev/null or a file if you need to keep it) bash ~/webSupport.sh pullVars "$b" >/dev/null 2>&1 & or close them: bash ~/webSupport.sh pullVars "$b" >&- 2>&- &

Categories : Bash

SharePoint + InfoPath Data Connections
Well, the answer I came up with seems to work pretty well- I am getting my data from the RESTful API built into SharePoint and filtering the data via my requests. Hope this helps someone else out there!

Categories : Sharepoint

scss output separate files
SASS provides handy tools to merge multiple source files into one or several resulting files, but it does not provide any facilities to split them. Also, as cimmanon already mentioned, your goal just does not make sense. It might be an XY Problem. If it is, please explain the original problem, not your solution to it. If it is not, just don't split the CSS file.

Categories : CSS

including separate files with functions
If you are wanting a single class to be split across files, you can use PARTIAL... Public Class MainClass ... End Class in a different file... Partial Class MainClass ... End Class The IDE will see these as a single class. Visual Studio also lets you use multiple dot filenames, so you can have MainClass.vb MainClass.FunctionSet.vb

Categories : Vb.Net

Can't separate header and source files in JNI
The undefined reference is outputted by the linker, not by the Compiler. This means there is no translation unit containing the functions you have used in your code. Telling by the Android.mk file I'd say foo.cpp is missing in your LOCAL_SRC_FILES Statement.

Categories : Android

You can't have JavaScript objects in separate files?
Just include the JavaScript you want which defines the object on the page and you should be good to go. Note that the order in which you include these files does matter. Example: <script src="js1.js" type="text/javascript"></script> // contains class <script src="js2.js" type="text/javascript"></script>

Categories : Javascript

Is their a way to add separate CSS and JS files for a particular part of web page
If you want to have JS and CSS specific to a certain part of a page, and you don't know JS and CSS, the only way is through iframes. If you've made the CSS yourself, you can just add a prefix to apply it to on certain sections. Not like this: p {color:pink} instead, add a prefix, like this: #menu p {color:pink} #content p {color:black} Your JS should only apply to elements based on id, unless your using something like jQuery. If you're using jQuery you can apply changes only to certain elements in the same way as CSS. eg. Not like this: jQuery('p').slider(); instead, add a prefix, like this: jQuery('#content p').slider();

Categories : Javascript

ember hbs templates as separate files
When you have templates in different files, you have to load them and compile them as EmberJS doesn't detect files. There are few ways to do that. 1) Load them to Ember.TEMPLATES: Ember loads the templates and pushes them in to an object Ember.TEMPLATES. it stores the templates content with small name key as per EmberJS Naming conventions. So we ourselves can push the templates after compiling them. Eg: If you have a template with the name 'post', load the post.hbs file through AJAX request then set, // "data" is html content returned from Ajax request Ember.TEMPLATES['post'] = Ember.Handlebars.compile(data) So now you can access the template directly as {{partial 'post'}} in handlebars or set as templateName for any view classes. App.OtherView = Ember.View.extend({ templa

Categories : Ember Js

Compile structs in c separate files
I haven't fully understood what you are trying to do. However, the definition of structure should be within and header file, for example a Matriz.h. Once you have define this file you can use the new structure by including Matriz.h via the include keyword in both files. This is the correct way to define a structure which is used by multiple files. For example : Matriz.h #ifndef MATRIZ_H #define MATRIZ_H typedef struct { int renglones; int columnas; } Matriz; #endif /* end of include guard: MATRIZ_H */ Then in your c file , you can just use #include "Matriz.h" You get a error because the compile does not know the size of the Matriz object when it is compiling the file where the structure is not defined. Let me know if you need more info.

Categories : C

How can I split this Coffeescript into separate files?
First, make sure you're including it in the application.js manifest file: //= require global //= require users Where global.coffee holds your utility methods. Your example users.coffee looks fine. However, you'll need to scope SITENAME to window so that it's accessible across the board. // global.coffee window.SITENAME = ... // users.coffee window.SITENAME.users = ... You'll need to do this because CoffeeScript will compile each file within it's own closure... thereby limiting scope unless you explicitly assign it to window. (function() { window.SITENAME.users = {}; }).call(this);

Categories : Javascript

how do I use functions from separate files in javascript?
Thanks to Quentin for pointing me towards the relevant documentation. The solution I ended up with is: sensitive.js: exports.data = "data"; app.js: var sensitive = require('./sensitive'); var data = sensitive.data;

Categories : Javascript

How to get Ember Data's "store" from anywhere in the application so that I can do store.find()?
The TRANSITION doc says that you can do this to inject the store into components : App.inject('component', 'store', 'store:main'); You might be able to change 'component' to 'view' or to 'model', but I'm not sure about that.

Categories : Ember Js

netcat gcc compile option so that IDA pro can show function name
You are probably using mingw on Windows. So, the -s option in the LDFLAGS means that the final binary will be stripped. Just remove this option. Moreover, you can try to add more debug information in order to help IDAPro to recover as much as possible from the program by adding -g3 to the CFLAGS and by replacing -DNDEBUG by -DDEBUG (it will also probably add more insightful messages from the software). At the end you should have something like this: CFLAGS=-g3 -DDEBUG -DWIN32 -D_CONSOLE -DTELNET -DGAPING_SECURITY_HOLE LDFLAGS=-lkernel32 -luser32 -lwsock32 -lwinmm Just as a side note, you may be answered much more efficiently about question on IDAPro on RE.

Categories : C

Qt tcp/ip server works with telnet, but not python or netcat
Use trimmedLineBuffer = lineBuffer.trimmed(); commandList = trimmedLineBuffer.split(' '); instead of lineBuffer.chop(2); lineBuffer.simplified(); From python append "/r/n" to the end of the string you are sending and everything will work fine!

Categories : Qt

netcat proxy shell issue on linux
Annoyingly it was the -p option which was tripping things up. The following command runs fine: nc -l 8080 <fifo | nc somehost.com 80 >fifo Then in another shell doing telnet localhost 8080 get / works fine.

Categories : Linux

WCF Duplex Service - Max Connections / Data Transfer
I am also trying to implement same kind of scenario. i have done some R & D with following approaches. WCF with wsDualHttpBinding - this approach work fine in local network and not work over internet because this need to have public IPs for both client and server. WCF with web socket with netHttpbinding - This is best option to implement duplex communication over internet but unfortunately This approach need to have both client and server win 8 or win 2012. WCF with nettcpbinding -This is the feasible and best approach for me. I manage to get it work over internet and i have tested on separate network. Now my worry is when thousands of clients connect to WCF service performance impact. If somebody has done this kind of development greatly appreciate your suggestions.

Categories : Dotnet

Using Dojo's modularity to separate javascript files
Please see Classy JavaScript with dojo/_base/declare. It describes how to define classes in Dojo. You have wrong sequence or arguments in define([...], function(<here>)) UI JS: define([ "dojo/_base/declare", "dojo/dom", "dijit/Dialog", "dijit/form/Form", "dojo/_base/connect", "dijit/form/Button", "dojo/request", "dojo/dom-attr", "dojo/json", "dojo/domReady!"], function(declare, dom, Dialog, connect, Button, request) { App JS: define([ "dojo/_base/declare", "esri/map" ], function(declare, Map) { Also in App JS you've defined Map so no need of writing map = new esri.Map("map", { but map = new Map("map", { PS: there might be dragons... these are just a few things I've noticed.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.