Posts

Showing posts from September, 2011

php - GROUP BY mysql showing only one row. But want repetitions also -

my table structure id order_id location time date 1 951 x 2/03/2013 2 951 x 13:00 2/03/2013 3 951 y 3/03/2013 i want show these in php group date like date 2/03/2013 orderid 951 location x orderid 951 location x date 3/03/2013 orderid 951 location y mysql query im performing select * table order_id=951 group date order id asc but query return first row of same data . how can show repetition in group date category. how use in php show data taking date separate variable. i editing question let know date can want order id show date in group including repetition. if want show rows in table, better order date, id grouping in php. $result = mysql_query("select * table order data asc,id asc"); $last_date = ""; while(($row=mysql_fetch_assoc($result))) { if($last_date != $row['date']) { echo "date " . $row['date'] . "\n"; ...

bash - How can I rename of old files? -

i have directory this: -rw-r--r-- 1 root root 0 jan 7 15:04 tmp_file2015_123_1_3123.log -rw-r--r-- 1 root root 0 jan 7 15:04 tmp_file2015_133_1_3123.log -rw-r--r-- 1 root root 0 jan 7 16:04 tmp_file2015_133_1_3125.log -rw-r--r-- 1 root root 0 jan 7 16:04 tmp_file2015_133_1__3223125.log -rw-r--r-- 1 root root 0 jan 7 16:04 tmp_file2015_133_1_3223125.log i need remove tmp_ , can this: for in *; s=$(sed -r 's/^(tmp_)(.*.log)/\2/' <<< $i); if [[ "$i" != "$s" ]]; mv "$i" "$s"; fi; done; but need older 1 hour (modified time) files: for example ( now: jan 7 16:10 ): -rw-r--r-- 1 root root 0 jan 7 13:00 file2015_123_1_3123.log -rw-r--r-- 1 root root 0 jan 7 15:04 file2015_133_1_3123.log -rw-r--r-- 1 root root 0 jan 7 15:01 file2015_133_1_3125.log -rw-r--r-- 1 root root 0 jan 7 16:04 tmp_file2015_133_1__3223125.log -rw-r--r-- 1 root root 0 jan 7 16:10 tmp_file2015_133_1_322...

sql server - TSQL - clone records for a day -

i'm working on creating lab big mssql database. simplify problem, let's assume it's 1 table (if can find better solution, can tables) i have data 1 day in table, between 525k , 630k records. want duplicate data different days (create history). i've tried different ways , i'm finding long. process taking 91 hours duplicate 1 day... brought down 16 minutes process 1 day (which makes approx. 91 hours duplicate year) . i'm wondering if there tool or made duplicate data or create history quickly? here's have right now: declare @idatecnt int=1, @tmpdate datetime, @idate int=365, -- counter create years worth of history. @datestart datetime = '2015-12-22' select f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, getdate() f11 #tmp_table1 table1 f1 = @datestart -- template day duplicated while @idatecnt<=@idate begin set @tmpdate = @datestart-@idatecnt delete table1 f1 = @tmpdate ins...

.htaccess - Why is my laravel 5.1.* project not working properly on XAMPP linux -

i have been working on 2 laravel 5.1.* projects. have been using built-in server , running projects so: php artisan serve http://localhost:8000 everything has been working have copied both projects , place in htdocs directory , accessing them so: project one: http://localhost/lara_rocks1/public/ this works when navigate across pages no authentication , registration function works. use the traits shipped laravel implement auth. example, when click login, logout etc, page refreshes , nothing happens. can problem? project two: http://localhost/the_future/public/auth/login for case, blank page shown. missing out? below content of .htaccess file in public folder: <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes if not folder... rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewri...

amazon web services - How to secure an AWS EC2 instance when the SSH key is compromised or lost -

i'm aws noob. i had developer set ec2 instance load balancer host node.js-based api. has moved on company still have private key log in, if wanted to. want change keys. from have read, need relaunch instance new key pair. however, if lose node packages, , other sw has been installed on current instance? happen load balancer? need need update dns info point new ip? (once situated, time around create multiple key pairs devs use.) thanks, steve edit: yes, have private key , can need to. want make sure no longer has access. take ami of current instance backup purposes. reboot instance keep existing ip. not need remove elb. may need ami if you cannot connect in after changing key. login root user, existing key. from shell, run following commands: $ ssh-keygen -t rsa -b 2048 -f user - generates new key pair $ sudo su - - if needed $ cp /home/ubuntu/.ssh/authorized_keys /home/ubuntu/.ssh/authorized_keys.bak - backup existing public key $ mv user.pub /home...

C++ - Global variable vs local variable read/write speed -

which fastest code among following ones? void foo1 (int & a) { = 10; } or void foo2 (void) { global_variable.a = 10; } (where global_variable global class element field 'a') ? is there difference in variable access/write times between local , global variables? it depend. (on program, on hardware, on compiler). if matters, measure , choose fastest. if doesn't matter, choose clearest , least introduce errors. (as others have noted, don't have local variable - have parameter passed reference.)

Using inline Assembly in C: Assigning labels in data segment -

i reading tutorial on printing characters in assembly vga-256 colors in dos. tutorial reading written in pascal, have little experience in language , vga programs in c. my question regarding label used access bitmaps of each character. in pascal have this: procedure chr6x7_dat; assembler; asm db $00,$00,$00,$00,$00,$00,$00,$00,$20,$20,$20,$20,$00,$20,$00,$50 db $50,$00,$00,$00,$00,$00,$50,$f8,$50,$50,$f8,$50,$00,$20,$f8,$a0 db $f8,$28,$f8,$00,$c8,$d0,$20,$20,$58,$98,$00,$40,$a0,$40,$a8,$90 db $68,$00,$20,$40,$00,$00,$00,$00,$00,$20,$40,$40,$40,$40,$20,$00 db $20,$10,$10,$10,$10,$20,$00,$50,$20,$f8,$20,$50,$00,$00,$20,$20 db $f8,$20,$20,$00,$00,$00,$00,$00,$60,$20,$40,$00,$00,$00,$f8,$00 db $00,$00,$00,$00,$00,$00,$00,$60,$60,$00,$00,$08,$10,$20,$40,$80 db $00,$70,$88,$98,$a8,$c8,$70,$00,$20,$60,$20,$20,$20,$70,$00,$70 db $88,$08,$70,$80,$f8,$00,$f8,$10,$30,$08,$88,$70,$00,$20,$40,$90 db $90,$f8,$10,$00,$f8,$80,$f0,$08,$88,$70,$00,$70,$80,$f0,$88,$8...

javascript - Why bootstrap dropdown calling window.onfocus -

when click on bootstrap dropdown link, custom set window.onfocus gets called. why bootstrap calling window.onfocus method? <ul class="nav navbar-nav navbar-right"> <li data-ng-show="username" class=""> <a href="javascript://" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">name<span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">logout</a></li> </ul> </li> </ul> window.onfocus = function() { alert("window onfocus called"); } jsfiddle link when click on menu, alert message shown. because bootstrap triggers focus event on dropdown anchor clicked. event naturally bubbles dom tree until reaches window, , functionality invoked. you can prevent this, using event.stoppropagation() : ...

Javascript location.replace and iframe -

following program can work in chrome, in firefox not work, need refresh page, otherwise page blank! the firefox jump out of store window use iframe not work, there ways around this? thanks all! var url = "/card/"+dl_path; saveframe.document.location.replace(url); <iframe id="saveframe" style="display: none"></iframe> if use jquery, can use $('#saveframe').attr('src', url) . should work browsers.

arrays - How check if a string is substring with indexof [JAVASCRIPT] -

i have method: function issubstring(word,array){} this method, given array of words , word, tries if word substring of others words in array. for(var i=0;i<array.length;i++){ if(json.stringify(array[i]).indexof(json.stringify(word))>0){ return 1; } } return 0; for example array=['home','dog'] , word='ho' ; word ho sub string of home method wrong. can me? you don't need json.stringify() , use string.prototype.indexof() the indexof() method returns index within calling string object of first occurrence of specified value, starting search @ fromindex . returns -1 if value not found. if(array[i].indexof(word) >-1 ){

android - How to manage multiple 'minigames' inside one application/game using Google Play Services? -

i have developed application game , therefore have decided make use of online multiplayer , register google play game services. after developing first minigame, working expected , not coming across issues. when developing second minigame, wondered how able uniquely allow users play multiplayer games on specific minigame? the application linked game service provides me app_id exists in manifest file so: <meta-data android:name="com.google.android.gms.games.app_id" android:value="@string/app_id" /> it seem make sense create multiple game services , link them application. how able handle multiple app_ids in application? when use googleapiclient , utilises app_id manifest , cannot specify specific app_id game service launch , provide connection google play games , google+: mgoogleapiclient = new googleapiclient.builder(this) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .addapi(plus.api)....

Jekyll permalink doesn't work -

i'm trying add new page jekyll site , declare permalink this: permalink: /new-page/ but new page ends in mydomain.com/pages/new-page/ instead of mydomain.com/new-page/ this worked before, must have happened after jekyll update. any idea might wrong? thanks in advance oh found problem. had forgot closing markdown dashes (---) after permalink.

php - Route protection from multiple referrer - Laravel -

i'm trying protect route if not accessed particular page , have below piece of code doesn't work expected; $referer = request::header('referer'); if ($referer != "http://www.xxx.co.uk/login" || $referer != "http://www.xxx.co.uk/signup") { return redirect()->route('/'); } i'm doing wrong if statement because below works; $referer = request::header('referer'); if ($referer != "http://www.xxx.co.uk/login") { return redirect()->route('/'); } the difference being removed or part. need protected if not accessed both paths . adding else if statement breaks aswell you have use && operator instead of || . in case, using ||, when single condition falsy, other truthy, statement executed.

html - How do I put my content in a box? -

i'm new html , css, have managed create basic website, have small menu on top consists of links directing different pages such "home", "about" , "contact". site gonna consist of information , pictures it's enough. anyway, feel site better if put content in box , have background on sides because text doesn't show when putting black outlines on letters. i'd put menu, logo , text inside box site: http://www.kakservice.se/?gclid=cj0keqiazai0brcs2yydo8yptuibeiqan3_lfqano2scd5hqcdw0jbwniaoayprzrg20x2a1lsbtircaako68p8haq (couldn't remember site in english design, suppose it's unimportant.) , preferably adding shadow @ border. so how go this? have searched online, don't know search for. thanks in advance. what need is, wrap contents of <body> tag inside wrapper like: <div id="wrap"> <!-- inside body. --> </div> and add following css: body {background: url("bg.jpg")...

ios - How to test UITextField in Xcode UI Testing when the text field is empty? -

i making uitest in xcode. when record test works fine when run test, gives error. these lines of code error occurs: xcuielement *cleartexttextfield = [app.textfields containingtype:xcuielementtypebutton identifier:@"clear text"].element; [cleartexttextfield typetext:@"sheffield"]; the error says ui testing failure - no matches found textfield i imagine because text field not have initial string , tester cannot find text box initial string "clear text" . i watched following tutorial on youtube. the demonstrators code turns out fine because textfield has initial string. (at least think problem is) is there way make test work empty text fields? there few ways this. if textfield has placeholder text can use placeholder text find textfield. you can use elementboundbyindex method textfield @ index. i.e. if textfield in app @ time can use xcuiapplication().textfields.e...

Generating base64 encoded md5 in C# and Python -

i trying convert python code c# language while converting have partially achieved target using simple string e.g "abc" in both languages , generating same encoded string stuck json object here python code . python import base64 , hashlib , hmac , json , httplib , socket , re , email,ssl,os time import strptime , mktime , timezone , time , gmtime , strftime , daylight h=hashlib.new ('md5') h.update(json.dumps({"username":"sym","password":"123"})) pprint.pprint(h.digest()) pprint.pprint(base64 . b64encode(h.digest())) c# using newtonsoft.json; using newtonsoft.json.linq; using system; using system.collections.generic; using system.collections.specialized; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.net; using system.net.security; using system.security.cryptography; using system.security.cryptography.x509...

php - Match single posted data with two column is mysql -

i have login form works if user email password , 2 pic correct echo logged in problem email match password match how can match images single [select html tag]. here html form.... <select name="image" multiple="multiple"> <?php for($i=0;$i<5;$i++) echo"<option data-img-src=\"$pic[$i]\" value=\"$pic[$i]\" ></option>"; ?> </select> and mysql query here ....... $mysql=mysql_query("select * `table` `email`='$email' , `password`='$pass' , `image1`='$image' , `image2`='$image'") or die(mysql_error()); if(mysql_num_rows($mysql) ==1){ $_session['user']= $email; header("location: home.php"); } else { echo "error"; session_destroy(); } if both images match logged in otherwise not the idea each 'image' tied id in code and/or database. when person selects image they...

asp.net mvc - Is there a design pattern to standardise the display of multiple models into a single view? -

i've tinkered derived classes, interfaces , viewmodels, haven't been able create quite need. say we're building cms following models: articleitem title summary content newsitem headline publishdate summary content eventitem eventtitle startdate enddate content i'm looking way standardise display of these 1 format / view (e.g. can display them in same rss feed). standardized view might called htmlitem , have 3 fields: title summary content the articleitem translate directly htmlitem , that's straightforward. for newsitem join publishdate , first 100 characters of content create summary field of htmlitem . for eventitem combine startdate , enddate create summary field of htmlitem . ultimately i'm looking easiest, efficient way able pass 3 models single view has been designed display htmlitem . best shot far has been create 'convertor' class each model, can't feeling there better way this. any exp...

modifying xml file using LibXML -

i'm trying modify file has xml syntax <!doctype xml> <lrf instance_prefix="u" pdescription="type:%20ddr2%20sdram;&#xa;density:%204gb;&#xa;data:%20x16;&#xa;banks:%208;&#xa;configuration:%2016m%20x%2016%20x%208;&#xa;voltage:%201.8v;&#xa;standard:%20jedec;&#xa;pins:%2084;&#xa;package:%20fbga;&#xa;package%20standard:%20mo-207;%20package%20variation:%20dk-z;&#xa;die:%20single%20die(sd)%20package;&#xa;target%20device%20family:%20virtex-7;" unit="mm" target_family="v7" jedec_type="ddr2_sdram_mo207_dk_z" y_offset="0" interface_type="normalinterface" x_offset="0" model_constraint="same_vccaux" pin_size="0.45"> <group group_number="1" group_name="address_control" group_constraint="memory_address" group_color="#9accff"> <pin pin_number="m8" pin_type="input" pin_s...

java - Iterate through an AVL tree -

i have implemented avl tree , wanted write iterator, searches in pre order. have peace of code , nullpointer in " stack.push(current) " , dont know why @override public iterator<e> iterator() { return new iterator<e>(){ node current; int counter; stack<node> stack; public void iterator() { counter++; stack = new stack<node>(); current = root; stack.empty(); } @override public boolean hasnext() { if(counter == count(root)) return false; else return true; } @override public e next() { stack.push(current); counter++; if(current.left.value != null) return current.left.value; else return current.right.value; } }; } thanks in beforehand :) your root object never declared or instantiated. setting current = root; in current ...

c++ - std::is_same result with lvalue and rvalue reference -

i playing std::is_same utility function in combination rvalue , lvalue reference , came across weird behavior. consider function template checks type of variable t. i using vs 2013 : struct test {}; template < class t> void h(t && t) { cout << " type &&: " << std::is_same<decltype(t), t &&>::value << endl; cout << " type &: " << std::is_same<decltype(t), t &>::value << endl; } i observe following outputs : h(test()); // type && : 1 type & : 0 which normal test() temporary object, , universal reference in parameter of h resolves r value reference (&& && = &&) but consider : test mytest; h(mytest); // type && : 1 type & : 1 !!! same result if write : test &mytest = test(): h(mytest); // type && : 1 type & : 1 !!! and same : test &&mytest = test(): h(mytest); // type &...

c# - ClickOnce app icon didn't update in some cases -

i maintain wpf application deployed via clickonce. when first installed it, using icon #1 our app icon (specified clicking properties on project , setting "icon" field); icon shows desktop shortcut. recently our company's logo changed updated icon icon #2 , deployed new release clickonce server. on of computers running software, upon receiving updated release, icon changed expected. however, on few, old icon still showing, though can see program has updated latest version deployed in clickonce. why this? has else encountered this? , can fix it? way, program self-signed; not sure if makes difference.

android - Get ProgressBar object from ProgressDialog -

is there way can "mprogress" object progressdialog.java class? i want set colour of indeterminate spinner white , keep same android style it. i've seen solutions using styling none have fit criteria. want same it, colour white. the reason want mprogress object can use below code on it: mprogressbar.getindeterminatedrawable().setcolorfilter(new lightingcolorfilter(0xff000000, 0xffffff)); found it! progressdialog progress = new progressdialog(this); alertdialog alert = progress; // not sure if need bit, required progressbar prog = (progressbar)progress.findviewbyid(android.r.id.progress); prog.getindeterminatedrawable().setcolorfilter(new lightingcolorfilter(0xff000000, 0xffffff));

sitecore8 - Sitecore Glass Mapper (v4): Add custom query string parameter via RenderImage -

using glass mapper sitecore version 4 (mvc), need following method call: @html.glass().renderimage(model, x => x.photofield, new {cropregion = xmlvalue.getcropregion()}, true, true) to result in: <img src="/sitecore/shell/-/media/default-website/cover.jpg?h=550&amp;w=1600&amp;la=en&amp;hash=2986ca8291803d4a8eac3b5a1c276e27d4877dcc&amp;cropregion=534,11,1348,548" width="1600" height="550" /> currently, renderimage call result in cropimage being added attribute rather on query string of image. there seems list of values that, if passed in renderimage, added query string parameters rather attributes, , list seems defined in main config class: imagequerystring = new hashset<string>(new[] { imageparameterkeys.output_method, imageparameterkeys.allow_stretch, imageparameterkeys.ignore_aspect_ratio, imageparameterkeys.scale, imageparamete...

Mysql python connector is unavailable when running pip install --allow external -

while using python 3.4 in docker container, have been using pip install mysql-connector-python --allow-external mysql-connector-python install dependency on new containers. suddenly, however, command fails saying "could not find downloads satisfy requirement". checked pypi , dependency still there, reason pip can't find ( https://pypi.python.org/pypi/mysql-connector-python/2.0.4 ). any ideas why no longer able see mysql-connector-python version 2.0.4 anymore , how can fix this? "with pep 470 requiring files hosted on pypi, may have noticed mysql connector/python no longer available using pip-tool." ... "for suggest download latest connector/python directly mysql homepage" see https://geert.vanderkelen.org/2016/cpy-and-pypi/

c# - How can i keep track of which randomly selected model was generated so it won't repeat again? -

this code generated random game object because there 9 game objects randomly generated object keeps re-generating more 1 time. how can restrict that, , have 1 game object generated once ? public gameobject[] models; public static gameobject currentpoint; int index; public static string randomname; public audiosource findthenumber; public void playnumbers() { models = gameobject.findgameobjectswithtag ("numbers"); index = random.range (0,models.length); currentpoint = models [index]; randomname = currentpoint.name; print ("trackable " + randomname); findthenumber.play (); currentpoint.getcomponent<audiosource> ().playdelayed(2); } if i've understood correctly, how keeping track of selected game objects in separate list. public static list<gameobject> models; public static list<gameobject> selectedmodels = new list<gameobje...

Android bluetooth connection with an obd2 -

till app can discover make discoverable , these.when press device's name example of near cellphone(which have opened bluetooth) appears in listview fact want.after when press ,i have classic error << "w/bluetoothadapter: getbluetoothservice() called no bluetoothmanagercallback w/system.err: java.io.ioexception: read failed, socket might closed or timeout, read ret: -1 ">>.it doesnt work bluetoothsocket.connect in code. in other case when go car tablet(which includes app android studio) can search obd2 , when press ,it makes bond requirement.i keying in 1234 password , make bond in tablets bluetooth features can see it.i need have did me next steps.for example how send command rpm or speed , take response.please me! here code: public class bluetoothactivity extends appcompatactivity { private static final string tag ="msg" ; private bluetoothadapter bluetoothadapter; private togglebutton togglebutton; private listview listview; private array...

css - Blurring background without restructuring html? -

i trying apply css blur property wrapper div, don't want affect text. framework using difficult restructure html. there way blue background , not text? html structure <div class="wrapper"> <h1>hello world</h1> </div> css .wrapper{ -webkit-filter: blur(5px); -moz-filter: blur(5px); -o-filter: blur(5px); -ms-filter: blur(5px); filter: blur(5px); background-color:red; } if point me direction of solution, if there one, appreciated. it's perhaps worth noting can't blur backgrounds ...only elements. so, pseudo-element answer here. .wrapper { position: relative; } .wrapper::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; -webkit-filter: blur(5px); -moz-filter: blur(5px); -o-filter: blur(5px); -ms-filter: blur(5px); filter: blur(5px); background-color: red; z-index: -1; } <div class="wrapper"> <h1>hell...

Open only specific folder in Visual Studio Code on Ubuntu 12.04 -

i downloaded latest vscode https://code.visualstudio.com/ on ubuntu 12.04. problem when file / open folder , choose specific folder opens entire /home/username in explore section. shows hidden folders , files annoying. has seen behavior , has suggestions on how fix it? thanks benjamin's suggestion here workaround: ./code ~/folder_name/

Angular 1.4.8 inner ng-show cause an error when used in custom directive root element -

i got error when put nested ng-show attributes custom directive, 1 attribute in markup of directive , second inside root element of directive template. my real scenario complex simplify example: suppose have my-custom-directive below contains ng-show: <my-custom-directive ng-show="somevalue >= 5"></my-custom-directive> and template of 'my-custom-directive' this: <div ng-show="options != null">my custom directive</div> those multiple ng-show cause error. if remove 1 of them or move inner ng-show @ least 1 level deeper in it's dom tree error gone (it's happen when it's location on root template element). this error tested on angular v1.4.8. is angular bug? or there reasonable explanation behavior? here plunker example: http://embed.plnkr.co/ztzvcfc5bfmjpo9t0isw thank in advance, menachem because directive has replace: true it trying merge 2 ng-show values resulting in error. s...

c# - Read/edit values starting from a Telerik RadGrid -

Image
i have situation: ... normal radgrid data. and, if clic on row, want obtain this: ... list of label-textbox pair (please pay attention: these list of data obtained row, not part of it). with first radgrid it's okay. therefore, have used simple html table list of pair (in second image). list being generated code-behind, database. the problem update of textboxs : if edit these textboxes , clic on update botton, starts myradgrid_updatecommand method. can't find way manage these textboxes (they don't appear in myradgrid.controls or else). so have tried use radgrid inside first radgrid, no luck... maybe have use different telerik control? someone know how can this? this part of implementation: protected void myradgrid_needdatasource(object source, gridneeddatasourceeventargs e) { this.myradgrid.datasource = this.dtlistadettagli; this.dtlistadettagli.primarykey = new datacolumn[] { this.dtlistadettagli.columns["key"] }; } protecte...

dns - Use Google Apps and Mandrill/Sendgrid to send emails -

right have dilemma email part of projects. i'm using sendgrid send , receive emails (via webhook ). email functionality integrated in web application , emails stored in database. want know possible next: use google apps receive inbound emails support@domain.com use google apps send outbound emails support@domain.com use sendgrid or mandrill send outbound transactional , news emails noreply@domain.com , news@domain.com current problem in mx records. both google , sendgrid mx records required set in dns, far understand 1 of them work. what best solution make possible? thank you. one possible solution: point mx records google top level domain, domain.com. create support@domain.com email next, create subdomain (i.e: sub.domain.com) , point mx records sendgrid. then, set news@domain.com forward news@sub.domain.com. way emails sent application. nothing needs changed sending outgoing transactional emails sendgrid. can send emails news@domain.com. recomme...

php - Bootstrap Carousel, loop every two items -

Image
i'm trying carousel show 2 items per slide in every loop isn't working @ moment, here code have:- <div id="hot-jobs-carousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <?php if ($x == 0) { echo '<li data-target="#hot-jobs-carousel" data-slide-to="0" class="active"></li>'; } else { echo '<li data-target="#hot-jobs-carousel" data-slide-to="'.$x.'"></li>'; } ?> </ol> <!-- wrapper slides --> <div class="carousel-inner" role="listbox"> <?php if ($x == 0 || $x == 1) { ?> <div class="item active"> <div class="col-md-12 row"> <a href="<?php echo get_permalink(); ?>...

php - Magento cant change product quantity in backend -

i have strange problem in magento. change in "inventory" tab of product, gets resettet after click on "save". has had similar problem in past? is there way simulate saving progress step step, can see error appears? until have tried to: disable addons reindex new delete complete cache in backend/via sql/via ssh delete products , categorys sorry lack of information. if need information please feel free ask. thank help! please try below solution may you i tracked down app/code/core/mage/cataloginventory/model/observer.php. the event catalog_product_save_after calls saveinventorydata method in turn calls _prepareitemforsave method. around line 225: $originalqty = $product->getdata('stock_data/original_inventory_qty'); if (strlen($originalqty)>0) { $item->setqtycorrection($item->getqty()-$originalqty); } if comment out line: $item->setqtycorrection($item->getqty()-$originalqty); it seems correct prob...

javascript - JQuery - SyntaxError: missing formal parameter -

i using find registered trademark symbols , tm symbols , wrap them in sup tag class. looked around since there couple people have asked question, none seem fix problem. here code $('body :not(script,sup)').contents().filter(function(){ return this.nodetype === 3; }).replacewith(function() { return this.nodevalue.replace(/[™®]/g, '<sup class="registermark">$&</sup>'); }); the error happening on first line $('body :not(script,sup)').contents().filter(function(){

mysql - Importing sql files to DB via Terminal. Is there a way to set default value for "ERROR 1366 at line ***: Incorrect integer value: ''? -

using terminal (ubuntu 15.10_64 + mysql 5.6) im inserting sql files database command: for in *.sql; mysql -u login_name -ppassword countries_mysql < $i; done where *.sql files contain strings like: insert region (id,vkl,tip,samonazvanie,mfa,stolica,samonazvanie_1,oficialno_1,cvet,flag,flag_svg,gerb,gerb_svg,mir_id,obj_id,kontinent,strana_id,region_id,ksi1,ksi2,ksi_sort,ksi_lat,iso_kod,gn_kod,telefon,pochta,avto,naselenie,ploshad,giddom,shirota_gradus,shirota_minuta,shirota_sekunda,dolgota_gradus,dolgota_minuta,dolgota_sekunda,sozdan,izmenen,vrem_pojas,dop_nazvanie,status,reforma_id,sxema_maska,tabl_id,tabl,pre_tabl,pre_id,post_tabl,post_id,uroven,nazvanie_1,opisanie_1,nazvanie_2,opisanie_2) values ('60448','0','0','gmina zalesie','','0','','','','','','','','0','0','0','130','52529','','','','','...

javascript - Making a GET request in AngularJS's config -

similar question here doesn't appear work in case. i'm using angular-ui's google maps api , requires configuration so: .config(function(uigmapgooglemapapiprovider) { uigmapgooglemapapiprovider.configure({ // key: 'your api key', v: '3.20', //defaults latest 3.x anyhow libraries: 'weather,geometry,visualization' }); }) i don't want have api key directly in here, i'd load in server using route via request ( '/api/googleapi' ). however, when try: .config(function($http, uigmapgooglemapapiprovider) { i get: failed instantiate module myapp due to: error: [$injector:unpr] unknown provider: $http are there workarounds or should brazenly chuck api key in here? based on @ryeballar's suggestion after reading link @ryeballer provided in comments other answer , there simpler workaround doesn't require mess pre-bootstrapping processing or xmlhttprequests or suggested in atyp...

django - accessing python object list -

i'm trying retrieve list of images in directory, , store list attribute of class. when try list object appears empty.this class: class hunting(models.model): code = models.charfield(max_length=10) description = models.charfield(max_length=500) images = {} def __str__(self): res = '' image in self.images: res = res+image return res def __unicode__(self): return self.id and populate , read list: page = int(page) huntings = paginator(hunting.objects.all(), 9) images = {} hunting in huntings.page(page): dir_name = settings.images_root+'\\theme1\\images\\cotos\\'+str(hunting.id)+'\\' # insert path directory path = os.path.join(settings.static_url, dir_name) print >>sys.stderr, '--path:' + path if os.path.exists(path): print >>sys.stderr, '--list image hunting '+str(hunting.id)+'--' img_list = os.listdir(path) ...

Java: Replace spaces in a String with a different whitespace character in? -

i have massive text file have manually parse. there no other way iterate on it. i'm grabbing each of lines in file , .split(" ") them individual components - int arrays, others char arrays, , other actual text strings. the text strings causing me headache because have space in there. an example line like: string strline = "identifier {2 4 \"#0# == \\\"this string\\\"\" 12 21 6} when following: string[] strparts = strline.split(" "); the resulting output string array has string values of: identifier,{2,4,"#0#,==,\"this,string\"",12,21,6} i need output be: identifier,{2,4,"#0# == \"this string\"",12,21,6} so i'm pondering if there different whitespace character can apply string inside quotes prior executing split(). anyone know of one? i considered diving regex, haven't worked regex enough able formulate logic around split - split on space unless space between fi...

Can't select images from database? (PHP) -

i never bofore used oop in php, in c#,c++ etc want make 1 website use oop. i want select photos slike table, , show in index page. this engine.php file select() function works good, select_slike() not select anything. can explain me please, error? thank you. <?php error_reporting(e_all); ini_set('display_errors', '0'); include("connect.php"); class manage{ public function select(){ $query = mysql_query("select naslov slike"); if($query) { while($row=mysql_fetch_array($query)){ echo '<option value="'.$row['slike_id'].'">'.$row['naslov'].'</option>'; } } else{ die(mysql_error()); } } public function select_slike(){ $query = mysql_query("select * slike"); if($query) { while($row = mysql_fetch_array($query)){ e...

javascript - How do I get the active route pathname in react-router 1? -

i have route defined like: <route path='/invite(/:invitetoken)' component={invitepage} key='/invite(/:invitetoken)' onenter={requireadmin} /> and current url is /invite/abc123 in code, how current route, can path/key? (i need index array) from docs: https://github.com/rackt/react-router/blob/latest/docs/introduction.md#adding-more-ui <route path="messages/:id" component={message} /> now visits urls inbox/messages/jkei3c32 match new route , build you: <message params={{ id: 'jkei3c32' }}/> so in case, use this.props.params.invitetoken in invitepage component.

excel - Create UDF in VBA Generated Workbook -

i'm building application in vba parse machine generated file. part of project need convert machine format integers since fixed width columns don't accommodate negative numbers. used macro recorder parse text file: workbooks.opentext filename:= _ *file name here*, origin:= _ 437, startrow:=1, datatype:=xlfixedwidth, fieldinfo:=array(array(0, 2), _ array(6, 2), array(10, 2), array(14, 2), array(19, 2), array(25, 2), array(27, 2), array(34 _ , 2), array(39, 2), array(43, 2), array(44, 2), array(52, 2)), trailingminusnumbers:= _ true but creates new workbook since it's opening new file. problem need run udf on final column converts fixed width value integer. example, suppose final column 0000000e , know e means last digit 5 , number negative. udf converts accordingly: public function convertcodetointeger(inputstring string) long if inputstring <> vbnullstring select case right(inputstring, 1) case "e" 'negative...

reactjs - How to reuse this little block of code in React.js? -

i'm total react newb, here code have: var examplecomponent = react.createclass({ getinitialstate: function() { return {close: false}; }, handleclick: function(event) { this.setstate({close: !this.state.close}); }, }); var buttonthing = react.createclass({ <examplecomponent />, render: function() { <div> yo </div> ); } }); where "examplecomponent" can used in multiple places? i've tried have above , putting in "examplecomponent" straight, no luck. or going wrong? code reuse in react facilitated concept called mixins. the react docs give concise example. for case var examplemixin = { getinitialstate: function() { return {close: false}; }, handleclick: function(event) { this.setstate({close: !this.state.close}); } } var buttonthing = react.createclass({ mixins: [examplemixin], // use mixin render: function() { return (<div> yo </div> ); } }); ...

javascript - Instance Date with dd/mm/YYYY format -

this question has answer here: where can find documentation on formatting date in javascript? 33 answers i'm trying instance date in way var date = new date('20/08/1990'); but returning invalid date. how can it? when passing string date constructor should use english notation dates, i.e yyyy/mm/dd . that means should passing new date('1990/08/20'); documentation date class here .

asp.net mvc - MVC C# - user creates dates from specific time zone -

in program have create screen user enter new start , end date/time. user has profile specifies time zone want work in. don't want relative local time zone. what want take start , end date/time user enters , convert utc based on user profile settings time zone. if user's profile set eastern standard time , specific start date 1/8/16 12:00, want convert est utc. don't want date "1/8/16 12:00" system's date or local time. can't seem figure out how define "1/8/16 12:00" est when conversion occurs utc user's input. does make sense? let me know if need more info/examples. you can save dates in database/nosql database/file /etc using utc format , either 2 between several ways it: console.writeline(date1.touniversaltime()); console.writeline(timezoneinfo.converttimetoutc(date1)) do query in server , send date in utc format can render client in specific timezone formatting using javascript, there several libraries can 1 @ top of h...

css - Polymer Elements - Responsive <body> font size -

i wonder best way make desktop/mobile page responsive polymer elements' iron-media-query ? of course, css define responsive behavior with @media screen , (max-device-width : 768px) body {font-size: 14px} ... @media screen , (min-device-width : 768px) ... body {font-size: 18px} ... however, polymer elements provides iron-media-query . now, what's better? , important: how can apply responsive font-size whole body or specific div's padding iron-media-query overall font size adjusts (all css elements defined x. em )? the iron-media-query allow binding result of query element paper-drawer-panel collapses when screen size below threshold. global settings use normal css. way fonts , other resources can downloaded while polymer being initialized.

reporting services - SSRS 2008: User Does Not Have Required Permissions -

Image
i have researched following existing questions , links reference: user '' not have required permissions, ssrs 2008 on windows 8 reporting services permissions on sql server r2 ssrs sql server reporting service - service manager error - user not have required permission i've taken steps outlined these suggested solutions, after , logging out , in, nothing has changed. in fact user name listed system administrator before started of this. one of solutions ( http://thecodeattic.wordpress.com/category/ssrs/ ) mentions "folder settings" area can specify roles user - "content manager," "publisher," "browser," "report builder," , "my reports" - don't see way navigate section anywhere. any ideas? thanks! ssrs has 2 security/role sections available in web gui: folder settings , site settings. navigation path each kind of weird. for folder settings, login report server (/reports default)....

How to select all values that are not numeric across multiple columns in SQL Server? -

i have 1 table prices id price_1 price_2 price_3 p1 10 11 12 p2 13 14 15 p3 aa 16 bb p4 19 cc 20 as can see above, values columns price_1 , price_2 , price_3 might not numeric. what want first find non-numeric values , give summary ( concatenate non-numeric values , columns 1 id) so above example, want is id bad_columns bad_values p3 price_1,price_3 aa,bb p4 price_2 cc how should write query? you this: with cte ( select id, value, columnname prices unpivot ( value columnname in ([price_1], [price_2], [price_3]) ) upvt isnumeric(value) = 0 ) select id, badcolumns = stuff((select ', ' + columnname cte cte.id = t.id xml path(''), type ).value('.', 'nvarchar(max)'), 1, 2, ...