Posts

java - How to make a list of JLabel's act as a button group? -

Image
as can see in picture characters selected want differently. want act radio button, example when click 1 character other characters should deselected. you can use if statement disable or make rest of labels invisible 1 of them selected.

c - SSH execute commands remotely -

i trying ssh remote server , execute simple command. using libssh library , following code, ssh_key pkey; ssh_session session; ssh_channel channel; int rc = ssh_pki_import_privkey_file(pc_private_key_file, null, null, null, &pkey); char buffer[1024]; unsigned int nbytes; printf("session...\n"); session = ssh_new(); if (session == null) exit(-1); ssh_options_set(session, ssh_options_host, pc_host); ssh_options_set(session, ssh_options_user, pc_user); ssh_options_set(session, ssh_options_port, &pc_port); ssh_options_set(session, ssh_options_log_verbosity, &pc_verbosity); printf("connecting...\n"); rc = ssh_connect(session); if (rc != ssh_ok) error(session); printf("channel...\n"); channel = ssh_channel_new(session); if (channel == null) exit(-1); printf("opening...\n"); rc = ssh_channel_open_session(channel); if (rc != ssh_ok) error(session); printf("executing remote command...\n"); rc = ssh_channel_request_exec(ch...

Load data into extended Bootstrap table with colspan -

excuse me, using this make table. 1 table header have property, colspan="6" . however, how can load data table? note. table structure is: <tr> <th colspan="6" class="col-xs-4" data-field="status" data-sortable="true">status</th> </tr> note. way load data bootstrap table is: $("#table").bootstraptable({data: data}); bootstrap-table not support rowspan , colspan header temporarily. more info : https://github.com/wenzhixin/bootstrap-table/issues/182 alternatively, can try below solution $('#table').bootstraptable({ columns: [{ field: 'id', title: 'item id' }, { field: 'name', title: 'item name' }, { field: 'price', title: 'item price' }, { field: 'color', title: 'item color' }, { f...

angular - Error occuring while reading json file in angular2 -

i trying read config.json file in angular2 service below- load() { return new promise((resolve, reject) => { this.http.get('./config.json') .map(res => res.json()) .subscribe((env_data) => { console.log('env_data: ' + env_data); this._env = env_data; }); } this contains list of key , value pairs of application configuration settings. structure of config.json file this- { "env": "development" } but, on calling load method of angular2 service, receiving below error- core.umd.js:3462 exception: unexpected token < in json @ position 0errorhandler.handleerror @ core.umd.js:3462next @ core.umd.js:6924schedulerfn @ core.umd.js:6172safesubscriber.__tryorunsub @ subscriber.ts:238safesubscriber.next @ subscriber.ts:190subscriber._next @ subscriber.ts:135subscriber.next @ subscriber.ts:95subject.next @ subject.ts:61eventemitter.emit @ core.umd.js:6164...

php - Call to a member function lists() on null in laravel 5.3 -

in laravel 5.3, trying edit registered users in users page (admin/users) , assign roles , permissions them. used codes laravel 5.2 pdf book. anytime click on user edit it. brings below error fatalthrowableerror in userscontroller.php line 26: call member function lists() on null. public function edit($id) { $user = user::whereid($id)->firstorfail(); $roles = role::all(); $selectedroles = $user->roles->lists('id')->toarray(); return view('backend.users.edit', compact('user', 'roles', 'selectedroles')); } the lists() function has been discontinued since laravel 5.3. should use pluck instead. $selectedroles = $user->roles->pluck('id'); regarding error: must not having roles particular user, hence error.

javascript - Passing a value to bundled React JS file? -

i wonder if possible pass argument react entry point. my entry point looks this: module.exports = { entry: "./js/components/application.js", output: { path: "./dist", filename: "bundle.js" }, // ... } my application.js: import react 'react'; import reactdom 'react-dom'; import anothercomponent './anothercomponent'; reactdom.render(<anothercomponent />, document.getelementbyid('content')); not bundle application webpack , include bundle in application. application provides div id "content": <body> <div id="content"></div> <script src="bundle.js" /> </body> i know can <script src="bundle.js" myargument="somevalue" /> but how can value passing react component anothercomponent property? what about <script id="bundle" src="bundle.js" myargumen...

python - UUID Field in django behave weired at mysql -

i have django model looks following class cdrbybusinessflowid(models.model): id = models.uuidfield(primary_key=true, default=uuid.uuid4, editable=false) cc_id = models.integerfield() business_flow_id = models.charfield(max_length=255, blank=true) status = models.charfield(max_length=10, blank=true) i have created model model api response following { "status": "pending", "business_flow_id": "13630f30-bfed-4e8d-bdbd-263d0da75175", "id": "3c337f4c-3236-4117-b519-c57fbcc001f8", "cc_id": "1610" } but unfortunately id doesn't exist in database. the value modified other value 1f604e31a4054d1e998b97433cc661a5 . thanks