Posts

Showing posts from January, 2010

php - Improving Ajax auto-complete to return better result -

i using ajax & php fetch elements matches keys(letters) entered user elements resembling database. for e.g database contain manufacturer names as: hydfloo, rexflex, easton, vickters, ever gush, thomas hydraulics, avt pumps and example user has entered letter "h" input box. receive hydfloo return , not thomas hydraulics along it. if "p" typed wd expect see "avt pumps". changes need make php in order able have values returned matches either first or second word of manufacturer name. php code <?php require('../config/connection.php'); if(!$dbc) { echo 'could not connect database.'; } else { if(isset($_post['querystring'])) { $querystring = mysqli_real_escape_string($dbc, $_post['querystring']); if(strlen($querystring) >0) { $query = mysqli_query($dbc, "select distinct name prdct_subcat name '$querystring%' limit 10"); echo '<ul>'; w...

java - How to generate n random numbers with a sum of m in public static void main (scanner)? -

i'm trying generate 4 different numbers second else if statement ( life_1.equals(a) , random integer third else if statement ( life_1.equals(c) without changing public static void main myscanner. answering , sorry if question doesnt make sense @ :/ system.out.println("do want use lifeline now? (y - yes or n - no)"); answer =myscanner.nextline(); boolean life=false; if (answer.equals("y")) { { system.out.println("alright. 1 of lifelines use?( f-fifty-fifty , a-ask audience, c-call friend)"); life_1= myscanner.nextline(); if (life_1.equals("f") && lifeline_5050 !=0){ system.out.println(" answer not b or d"); lifeline_5050 = lifeline_5050 - 1; life=true; } else if (life_1.equals("a") && lifeline_ask != 0) { system.out.println("the audeince answers are: a."+randomnum1+ "b. "+randomnum2+"c. "+randomnum3+ "d. "+ran...

Having trouble with using C++ library in C# -

so i'm writing program uses 3rd party dll written in c++. i'd write program in c#, since know thing or 2 language , never did in c++. got library called ciusblib in pack of files: .dll, .h, .lib, .ext. program meant target computer (win7 32bit), different i'm developing on (win10 , win8 both 64bit) - have limited access target computer. i'm using visual studio 2015 , according vs's object browser dll contains classes several methods want use. found there 3 methods available - reference library in c# project, p/invoke (using dllimport) , c++/cli wrapper. so first tried referencing library in c# project, directly crashes on instantiating class on both dev computers , throws accessviolationexception on target computer. wasn't able figure out why it's happening blamed on library's code being unmanaged. after doing research found dllimport can't used on methods closed in class. tried c++/cli wrapper, realized referencing c++ library in visual...

javascript - How do i prevent subfolders access via anonymous http-url-path inspite of password-protected aspx.default file on parent-folder? -

could info on how keep files , folders free anonymous http access, besides i've done. aspx project-folder gateway/default file aspx.net/vb.net password protected web-page, works well. if knows , types full url path html-file or subfolder within, still gain access (bypassing aspx password page). here's i've done far==== ---utilizing settings of iis-7 server, i've attempted rendering subfolders not accessible anonymous browsers, after doing aspx password page becomes ineffective in redirecting subfolders , htl files within. after putting in correct password on aspx password page, run 404-unauthorized access error msg, means password authorized access disabled when turn off anonymous access subfolders. could have fact aspx password entry page submit-button not pointing aspx page rather, pointing html pages within subfolder? i believe using web.sitemap xml configuration file can you. https://msdn.microsoft.com/en-us/library/ms178428.aspx

c++ - Black screen while trying to display drawing on screen -

i started learn opengl, , im stuck on problem, when try make resizable window, object not showing on window, , cant figure why. if can take quick wrong of big help. best regards. #include <stdio.h> #include <stdlib.h> #include <gl/glut.h> void initlights(); void reshape(int width, int height); void display(); void renderscene(); int w; int h; int main(int argc, char** argv) { glutinit(&argc, argv); //metodi se predaje dva argumenta - andresa varijable koja sadrži broj argumenata iz komandne linije, te polje tih argumenata glutinitdisplaymode(glut_double); glenable(gl_lighting); glutinitwindowsize(w, h); //dimenzije prozora u pikselima glutinitwindowposition(0, 0); //pozicija gornjeg lijevo kuta u kojem će se scena iscrtati, prvi argument je x, drugi y glutcreatewindow("primjer 1"); //stvaranje prozora u kojem će se iscrtati scena ("naziv prozora") glutdisplayfunc(display); //registracija metode display, vraća podatak tipa ...

How to scrape html table only after data loads using Python Requests? -

i trying learn data scraping using python , have been using requests , beautifulsoup4 libraries. works normal websites. when tried data out of websites table data loads after delay, found empty table. examples this webpage the script i've tried routine one. import requests bs4 import beautifulsoup response = requests.get("http://www.oddsportal.com/soccer/england/premier-league/everton-arsenal-tnwxil2o#over-under;2") soup = beautifulsoup(response.text, "html.parser") content = soup.find('div', {'id': 'odds-data-portal'}) the data loads in table odds-data-portal in page code doesn't give me that. how can make sure table loaded data , first? you need use selenium html. though continue use beautifulsoup parse follows: from bs4 import beautifulsoup operator import itemgetter selenium import webdriver url = "http://www.oddsportal.com/soccer/england/premier-league/everton-arsenal-tnwxil2o#over-under;2" b...

c# - Creating a List of Unity Objects -

i'm trying create strip of sprites. created list of game objects , seems work ok. except have duplicate object in game view, seemed need destroy "template object". when looks fine, when try move them says i'm trying access object has been destroyed. can explain issue? seems i'm confused on instantiate , how works exactly. under impression object isn't created in game view until instantiate. why duplicate object? input. using unityengine; using system.collections; using system.collections.generic; public class reelstrip : monobehaviour { public list <sprite> image = new list<sprite>(); public list <int> index = new list<int>(); public list <gameobject> symbol = new list<gameobject> (); public int reelnumber; public float symbolheight = 1.74f; public float symbolwidth = 2.00f; public float speed = 0.01f; // use initialization void start () { reelnumber = 0; l...

jquery - create DOM elements with data value from a javascript -

i have site basic information outpout in javscript. don't have access server side of things - , wonder if use jquery/vanilla js create dom element value script? the script looks this: var retailerdata = { "del": { "zip": "", "city": "" }, "user": { "country": "denmark", "phone": "0000", "nbrorders": 0, "name": "john doe", "salesperson": "frederik jensen", "customerno": "5464564564", "email": "johndoe@test.dk" }, "order": { "shippingsum": 0.0, "orderno": "", "voucher": "", "currency": "", "ordervat": 0.0, "ordersum": 0.0, "items": [] ...

Try to use an evaluator JaninoEventEvaluator in logback. But does not work to filter out depending on condition -

try use evaluator janinoeventevaluator in logback. not work filter out depending on condition. my configuration of logback.xml given below. <appender name="durgadlyfilesql" class="ch.qos.logback.core.fileappender"> <file>${durga.log.file.name.sql}</file> <encoder> <pattern>${screenconversionpattern}</pattern> </encoder> <filter class="ch.qos.logback.core.filter.evaluatorfilter"> <evaluator name="loggingtaskeval" class="ch.qos.logback.classic.boolex.janinoeventevaluator"> <expression> system.out.println("mdc: " + mdc + " " + mdc.get("screenname")); string screen = (string) mdc.get("screenname"); if ((screen == null) || screen.equals("server type entry/amend/cancel")) { return false; } </expression> </evaluator> <onmatch>accept</onmatch> <onmismatch>deny</onmismatch> ...

Jmeter - how do i run two samplers as a bundle -

right have 2 api methods test post indexmember delete indexmember the problem indexmember has got fields have unique. therefore, when run post & delete once (# of threads == 1; loop == 1) - works fine. indexmember gets posted, deleted, post again , it's fine, unique values still unique then. but when add more threads => jmeter starts posting several indexmembers altogether , of methods fail our custom validation "errors": [ { "message": "the index member indexid [id] , securityid [id] present in database." } ], "success": false i thinking on making delete function kind of sub-sampler post. so post , delete go in 1 thread. any advice appreciated. i suggest have both post , delete request under same thread group , make sure give enough ramp time...

ios - Swift: Add Certificate Authority root certificate -

we're attempting follow apple docs using own certificate authority (ca): while self-signed certificate reasonable approach during development, there better way: create own certificate authority ... , have issue certificate test server. can ... hard-wire certificate authority's root certificate app i haven't been able figure out how hard wire ca root cert using swift. paper mentions approach haven't been able translate swift code: get copy of remote peer's certificate ... get server certificate trust object (pass index of 0 sectrustgetcertificateatindex) get data server certificate (seccertificatecopydata) compare certificate data got in step 1; if match, you're talking correct peer how can via swift?

Webpack-dev-server serves old file content -

i have simple project: appdir +- app +- main.js +- build +- bundle.js +- index.html +- webpack.config.js the webpack.config.js: var path=require("path"); module.exports = { entry: path.resolve(__dirname, "./app/main.js"), output: { path: path.resolve(__dirname, "build"), filename: "bundle.js" } }; after changs main.js , webpack-dev-server seems detects change , performs rebundle bundle.js , browser still recieve old content of main.js . i start server executing webpack-dev-server webpack.config.js any ideas? looking https://github.com/webpack/webpack-dev-server/issues/24 , add publicpath webpack.config.js , webpack serves bundle new content ^_^ var path=require("path"); module.exports = { entry: path.resolve(__dirname, "./app/main.js"), output: { path: path.resolve(__dirname, "build"), filename: "bundl...

java - Video Player Null Pointer Exception using Google Media Framework Exoplayer -

i using gmf sample play video in app, fetching video title , url live json, here sample of json : { "videos": [ { "title":"video 1", "url":"88.mp4" }, { "title":"video 2", "url":"l5.mp4" } ]} and code looks : mainactivity.java: jsonobject jsono = new jsonobject(data); jsonarray jarray = jsono.getjsonarray("videos"); (int = 0; < jarray.length(); i++) { jsonobject object = jarray.getjsonobject(i); videos video = new videos(); video.settitle(object.getstring("title")); video.seturl(object.getstring("url")); videosarraylist.add(video); } whenever, tap on of list item play video, getting npe , see complete log : 03-17 13:14:34.667 18799-18799/com.google.googlemediaframeworkdemo.demo e/androidruntime: fatal exception: main process: com.google.googlemediaframeworkdemo.demo, pid: 18799 java.lang.nullpoin...

c# - autoincrement number in textbox -

how autoincrement value in textbox1(which id) everytime click save button? problem value in textbox1 increments everytime run winform. for example, run winform , last value id has 2, textbox1 generate number 3 , after click save button doesn't generate next number instead increment if close form , rerun again. plsss help.. in form load private void form1_load(object sender, eventargs e) { int a; string path1 = "data source=localhost; initial catalog= ss; username=root; password=''"; mysqlconnection con = new mysqlconnection(path1); con.open(); string query = "select max(id) inc"; mysqlcommand cmd = new mysqlcommand(query, con); mysqldatareader dr = cmd.executereader(); if (dr.read()) { string val = dr[0].tostring(); if (val == "") { textbox1.text = "1"; } else {...

python - Numpy savez exceptions -

i found statement: np.savez not multi-process safe, because uses gettempdir() + key + ".npy". so, if you're running same script on different data sets, roach own data when 1 process removes /tmp/arr_0.npy of process. as luck have it, i'm in exact situation, have example error: traceback (most recent call last): file "/home/pedro/prospectus/prelim/bbvs/bin/skldthresh", line 99, in <module> main() file "/home/pedro/prospectus/prelim/bbvs/bin/skldthresh", line 90, in main np.savez("%smask-t%0.2f" % (outfile,threshold), result) file "/usr/lib/python2.5/site-packages/numpy/lib/io.py", line 230, in savez zip.write(filename, arcname=fname) file "/usr/lib/python2.5/zipfile.py", line 541, in write st = os.stat(filename) oserror: [errno 2] no such file or directory: '/tmp/arr_0.npy' fortunately, replacing tempfile.gettempdir() tempfile.mkdtemp() , rememb...

.htaccess - Godaddy php session not working -

i having issue php sessions returning wrong values when uploaded godaddy (linux) hosting environment. works locally on wampserver (windows 10) absolutely fine. trying use abrahams twitter library, , mentioned works locally. the code quite simple: 2 files, index.html: <?php error_reporting( e_all ); session_save_path('/home/aureagle/public_html/sgorilla.com/sessions'); session_start(); echo "<br>" . session_save_path() . "<br>"; require "twitteroauth/autoload.php"; use abraham\twitteroauth\twitteroauth; define('consumer_key', 'xxx'); define('consumer_secret', 'yyy'); define('oauth_callback', 'http://www.sgorilla.com/report.php'); $connection = new twitteroauth(consumer_key, consumer_secret); $request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => oauth_callback)); $_session['oauth_token'] = $request_token...

sql server - Quoted and Unquoted comma separated list in T-SQL -

i've requirement need select column in sql table 2 separate fields containing comma separated values - 1 should quoted , other 1 should unquoted. so example, if table has values b c d e in single column, select sql statement should return 2 fields - 1 field containing values 'a','b','c','d','e' , other 1 containing values a,b,c,d,e. i'm running following sql statement achieve this: select substring((select top 100 ''',''' + cast(sales_id nvarchar(50)) sales_order_header (status = 0) order updated_datetime, 1 xml path('')),3,2147483647) + '''' quoted, substring((select top 100 ',' + cast(sales_id nvarchar(50)) sales_order_header (status = 0) order updated_datetime, 1 xml path('')),2,2147483647) + '' unquoted however, had ...

How to raise an event in VB.NET when a row is added to an SQL Server table -

not sure possible. currently, detect row has been added table in sql server, use timer query table. there way sql server (presumably via ado.net sqlconnection object) can raise event in visual basic when row added, don't need keep polling/querying database? if using sql server 2005+, can use service broker , query notifications . the setup bit complicated. in short use sqldependency class . dependency first has created system.data.sqlclient.sqldependency.start(cs) and can used dim cmd new sqlcommand(sqlquery, cn) cmd.commandtext = "select field dbo.mytable" sqld = new sqldependency(cmd) cn.open() dim tbl new datatable tbl.load(cmd.executereader) addhandler sqld.onchange, addressof tablechanged the dependency should not used lot of clients , there strict rules ( creating query notification ) how query should written.

c# - New instance of Word acts as a child process to existing hosted Word application -

i working on word automation tool, host word in wpf window. use following code create new word application // initialize handle value invalid appwin = intptr.zero; // start remote application try { // start process if (_wordapp == null) _wordapp = new applicationclass(); _wordapp.application.caption = word_app_name; //find process appwin = findwindow("opusapp", _wordapp.application.caption); } catch (exception ex) { messagebox.show(this, ex.message, "error"); } // put form setparent(appwin, this.handle); on closing application want spawned word apps killed. protected override void onhandledestroyed(eventargs e) { // stop application if (appwin != intptr.zero) { // sure word app closes without trace try { uint pid; ...

PHP How to access argument of function inside anonymous function? -

i need access first argument function inside anonymous function passed second argument said function. example: <?php function a($arg, $func) { echo $func(); } a("argument 1", function () use($arg) {return $arg;}); ?> the above return following error: notice: undefined variable: arg in path/to/file.php on line 5 while desired result be: argument 1 try below solution: function a($arg, $func) { echo $func($arg); } a("argument 1", function ($arg) {return $arg;}); output argument 1 for more detail have @ http://php.net/manual/en/functions.anonymous.php

html - An image does't show up on my local server in Rails -

i'm trying show image(lady enjoy.png) set on image file in asset file does't appear. think codes correct though. <article class="project2"> <div class="media"> <a href="#"> <img src="<% asset_path "ladyenjoy.jpg" %>" alt="" title=""> </a> </div> <div class="details"> <a href="work_details.html"> <h1>enjoy it!</h1> </a> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo ...</p> </div> </article> you not need execute code, put there well, , in case need equal( = ) sign there. <%= asset_path "ladyenjoy.jpg" %> <% %> execute code, didn't print/put...

node.js - How to convert ISO 8601 date format to specific format? -

i able retrieve dates , want converted format "1 week ago" or "2 week ago" . the date format inputting in format: 2016-02-15t19:43:14.412-0500 you can use fromnow() in moment.js you; var moment = require('moment') moment('2016-02-15t19:43:14.412-0500').fromnow(); // outputs '20 days ago'

sql - query without union pivot select -

hello have query below execution time long. please introduced me try different solution .there query(oracle 10g) select * (with t (select cor_id, cor_cod, wei1, days, 'wei1' wei_type (table)) select * t pivot(max(wei1) for(days) in('01' day_01, '02' day_02, '03' day_03, '04' day_04, '05' day_05, '06' day_06, '07' day_07, '08' day_08))) union (with t (select cor_id, cor_cod, wei2, days, 'wei2' wei_type (table)) select * t pivot(max(wei2) for(days) in('01' day_01, ...

jquery - Upload image using javascript 4 -

i have image upload box this, part of submission form. <li id="field_1_14" class="gfield field_sublabel_below field_description_above"><label class="gfield_label">Ảnh</label><div class="gfield_description">Ảnh hàng hóa bạn muốn mua hộ</div><div class="ginput_container ginput_container_fileupload"><div id="gform_multifile_upload_1_14" data-settings="{&quot;runtimes&quot;:&quot;html5,flash,html4&quot;,&quot;browse_button&quot;:&quot;gform_browse_button_1_14&quot;,&quot;container&quot;:&quot;gform_multifile_upload_1_14&quot;,&quot;drop_element&quot;:&quot;gform_drag_drop_area_1_14&quot;,&quot;filelist&quot;:&quot;gform_preview_1_14&quot;,&quot;unique_names&quot;:true,&quot;file_data_name&quot;:&quot;file&quot;,&quot;url&quot;:&quot;http:\/\/localhost\/?gf_page=5c2826...

Android Expandable RecyclerView as Tabs of viewpager -

Image
i'm trying display 1 activity picture below thread. want make 1 display have: 1 viewpager , 1 header need custom header: 1 recyclerview expandable(please see picture), handler clicked recyclerexpandable setcurrent page make viewpager scroll position follow header, want make when viewpager swipe next page, header charger background item (child , parent), when next done child item go parent, old child list close. try 1 solution : explistview.setonchildclicklistener(new expandablelistview.onchildclicklistener() { public boolean onchildclick(expandablelistview parent, view v, int groupposition, int childposition, long id) { final string selected = (string) explistadapter.getchild( groupposition, childposition); if(your condition){ }else if(your condition2) { }else{ } } }

Django SSO with Microsoft ADFS -

my question may broad or vague, cannot best describe in other way doing it. i have multiple django applications. have implemented sso same. things work. now, have been given new task , this. i have integrate microsoft adfs authentication suite of applications , broaden scope of current sso. my understanding of as, when log laptop on corporate network (i assume how have put it) logged django applications i have no idea of how work have no experience adfs. can experience of explain scenario of how works can understand , think of solution it. ps: if there more information needed provide. also, if downvoting question put reason can edit question , post should be. if django supports saml based login, set trust adfs. adfs automatically take care of logging in using logged in credentials domain joined machine inside corporate network. if user accessed externally, prompt password or certificate based auth (e.g. smartcard) login user.

SQL Server edition for BI developers - Complete BI suite -

i don't know whether questions stands correctly or not stack. i msbi developer working sql server enterprise edition, newbie sql server editions... i know edition of sql server can install @ home desktop, bundled complete msbi suite features. thanks, the bi tools vs 2015 available @ no cost , work sku of visual studio 2015 -- express, community, enterprise, of 'em. in fact, if don't have visual studio 2015 installed on machine, installer bi tools install vs2015 you. can download ssdt tools bi development here clicking on latest ssdt preview visual studio 2015: https://msdn.microsoft.com/en-us/library/mt204009.aspx

c# - Getting value from database and add it's Value? -

Image
i have datagridview , call values phpmyadmin , try add it's value row when edit cell 1 gets same value mysqlconnection conn = new mysqlconnection("datasource=localhost;port = 3306;username = root;password = "); mysqlcommand comm = new mysqlcommand("select fee,amount system.other_school_fees ;", conn); mysqldataadapter ssda = new mysqldataadapter(); ssda.selectcommand = comm; datatable ddbdataset = new datatable(); ssda.fill(ddbdataset); bindingsource bbsource = new bindingsource(); bbsource.datasource = ddbdataset; datagridview2.datasource = bbsource; ssda.update(ddbdataset); datagridview2.autosizecolumnsmode = datagridviewautosizecolumnsmode.allcells; int d = 0; (int b = 0; b < datagridview2.rows.count; b++) { d += convert.toint32(datagridview2.rows[b].cells[1].value); ...

java.lang.NoClassDefFoundError: Could not initialize class org.mockito.internal.util.MockUtil -

i want use testng + powermock + spring run test code,my jar version is: powermock = 1.6.2 powermock-module-testng = 1.6.2 mockito = 1.10.19 testng = 6.8.7 spring = 4.1.1.release jdk = 1.8.0 and test code follows,and not extends autobasetest, can run normal,autobasetest contains @contextconfiguration(locations={"/test/resources/applicationcontext-test.xml"}) @preparefortest({test.class}) public class mocktest extends autobasetest { @objectfactory public iobjectfactory getobjectfactory() { return new powermockobjectfactory(); } @test public final void test() throws exception { ...... } } the error stack : `failed configuration: @beforeclass springtestcontextbeforetestclass java.lang.exceptionininitializererror @ org.mockito.internal.exceptions.stacktrace.conditionalstacktracefilter.(conditionalstacktracefilter.java:17) @ org.mockito.exceptions.base.mockitoexception.filterstacktrace(mockitoexception.java:41...

c - Figuring out the function of cascade of ternary operators? -

Image
i'm trying implement simple (and easy understand) version of merge sort , after bit of research i found following c version : #include <stdio.h> #include <stdlib.h> void merge (int *a, int n, int m) { //... int i, j, k; // allocate memory on heap temp array int *x = malloc(n * sizeof (int)); // happening here (sorting) (i = 0, j = m, k = 0; k < n; k++) { x[k] = j == n ? a[i++] : == m ? a[j++] : a[j] < a[i] ? a[j++] : a[i++]; } // deep copy of temp elements initial array (i = 0; < n; i++) { a[i] = x[i]; } // free temp array free(x); } //--------------------------------------------------------------------- void merge_sort (int *a, int n) { // base case (subarray 2 elements) if (n < 2) { return; } // find index of middle element int m = n / 2; // divide 2 merge_sort(a, ...

javascript - Disable browser closing while transaction ..? -

i working on 1 payment getway project boss give me 1 task disable browser closing while transaction process try last 2 days can't done 1 please me ....(jsp/servlet) in advance dear , first of keep thing in mind can't prevent user close window or tab. only can remind him creating alert / confirm box if tries close window or tab. now, coming point have add event name onbeforeunload using javascript. done : window.onbeforeunload = function() { return 'you have unsaved changes!'; } thanks & cheers :)

javascript - Show/hide areas of form (im using bootstrap) -

i show different areas on form dependent on selected. can javascript use jquery effects better. i've seen lots of jquery examples on net cannot see how implement form. would possible show me 1 example on form , able rest. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>basic form</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxazxuh4hwsyylfb+j125mxis6mr5fohampbg064zb+afewh94ndvacbm8qnd" crossorigin="anonymous"> </head> <body> <div class="container"> <div class="row"> <div class="content-main col...

json - Problems with rendering view when using DataTable in Laravel 5.2 -

i using datatables in laravel 5.2, seems can pass json data failed render view. dunno wrong here. here datatable controller code: public function getindex() { return view('event.report'); } /** * process datatables ajax request. * * @return \illuminate\http\jsonresponse */ public function anydata(request $request) { //$developers = event::lists('developer','developer'); $events = event::select(['name','startdate','enddate','venue','developer','client','agency','allowance']); return \datatables::of($events) ->filter(function ($query) use ($request) { if ($request->input('developer')) { $query->where('developer', '=', "{$request->get('developer')}"); } }) ->make(true); } he...