Posts

Showing posts from July, 2012

indexing - How to Create an index of a key in a map or item in a list in MongoDB -

the following questions refer example. how create index ids in idsandnames map? i want search these numbers: 7065362, 7064458, 7065003, 7064286... how create index strings in subtargets list? i want search these strings: all, action, drama... my example : { "_id" : objectid("sdfsdfsdfsdfsdfsd910d41ad9"), "targets" : { "superheroes" : { "idsandnames" : { "7065362" : "doctor strange", "7064458" : "dr. manhattan", "7065003" : "captain atom", "7064286" : "hulk" }, "subtargets" : [ "all", "action", "drama" ] } "bestsuperheroes" : { "idsandnames" : { "7065362" :

Android Studio Importing, cannot find file "settings.jar"? -

i decompiled apk file folder.(tried apktool , online decompiler) importing project android studio, shows "cannot find file ...decompiled_apk_file_name\settings.jar". in decompiled folder there folders: build, dist, res, smali, and 2 files: androidmanifest.xml, apktool.yml how solve this? much!

How can I transform a list of Strings into another form in Scala? -

i have list of strings take following form: 000000 011220 011220 033440 033440 000000 i'd transform these strings list of values represents each 2x2 block while preserving row information. irrelevant whether data representing each 2x2 block stored in list or tuple. example, 2x2 block representing upper left corner in 1 of following forms: (0, 0, 0, 1) list((0, 0), (0, 1)) list(0, 0, 0, 1) list(list(0, 0), list(0, 1)) the scala code below performs prescribed transformation, seems overly complex. can break of functionality separate functions, cannot see how code can converted simpler form for-comprehension. note: i've simplified list of values brevity. scala> val data = list("000000", "011220", "033440") data: list[string] = list(000000, 011220, 033440) scala> val values = (data map { _.tolist.sliding(2).tolist } sliding(2) map { _.transpose } map { _ map { _.flatten } }).tolist values: list[list[list[char]]] = list(l

batch file - how to escape every character up to a point? -

situation : i want variable contain command can execute doing : %command% tries : set command=echo file used cleaning executable ^>^> dummyfile %command% this works, have specific editing each command... isn't there take after = symbol quote? set command="echo file used cleaning executable >> dummyfile" %command% then command not recognised because of quotes your idea quoting not bad: set "command=echo file used cleaning executable >> dummyfile"

Delete empty csv files in directory - R -

have many csv files in folder (1.csv,2.csv....,20.csv) few of them empty (5.csv,8.csv). empty files contain size around 4 bytes , not size 0. need delete them in directory , want achieve in r. possible? appreciate help! the function countlines() r.utils package job: library(r.utils) lapply(filter(function(x) countlines(x)==0, list.files(pattern='.csv')), unlink)

jquery - Javascript function that can be used by many elements and then distinguish which element clicked it -

for example have 12 div tags each represent month. when clicked each 1 display div month , hide other months divs the 12 month divs have class month in common. sections each contain content month have month_section in common , name of month represent uncommon. my javascript code far: $("#january,#february,#march,#april").click(function(e)){ $(".month").removeclass("highlight"); $(".month_sections").removeclass("show"); $(".month_sections").addclass("hide"); if(this == "#january"){(this).addclass("highlight");$(".january").addclass("show");} else if(this == "#february"){(this).addclass("highlight");$(".february").addclass("show");} else if(this == "#march"){(this).addclass("highlight");$(".march").addclass("show");} else if(this == "#april"){(this).addclass("h

Python Tkinter Grid Checkbox -

i wondering if there easy way create grid of checkboxes using tkinter. trying make grid of 10 rows , columns (so 100 checkboxes) 2 checkboxes can selected per row. edit: i'm using python 2.7 spyder what have far: from tkinter import* master = tk() master.title("select groups") rows=10 columns=10 x in range(rows): y in range(columns): label(master, text= "group %s"%(y+1)).grid(row=0,column=y+1) label(master, text= "test %s"%(x+1)).grid(row=x+1,column=0) checkbutton(master).grid(row=x+1, column=y+1) mainloop() i'm trying use state='disabled' grey out row once 2 checkboxes have been selected. here's example using provided 10x10 grid. should give basic idea of how implement this. just make sure keep reference every checkbutton ( boxes in example) every intvar ( boxvars in example). here's why: - checkbuttons needed call config(state = disabled/normal) . - intvars needed

Selenium Webdriver to wait for loading frame content in c# -

i doing selenium webdriver automation facing critical issue frame. in application there link named --print. when user clicks on print link ...one frame window gets opened . on frame there submit button along checkboxes , links. when user selects checkboxes , clicks on "submit" button time again result means" selected checkboxes , links" got displayed on frame. but problem there many links loaded after time. have requirement not use explicit wait because doing performance testing. have wail till frame content load without explicit wait. i have tried many things below while (!table.findelement(by.xpath("//*[contains(text(),'" + tin + "')]/following::span")).text.equals("complete")) //while(!table.findelement(by.xpath("//*[contains(text(),'" + tin + "')]/following::span")).text.equals("complete")) { c

javascript - Magnific popup transparent png as grey -

i facing problem magnific popup - when transparent png opens, transparent parts grey. have searched solution without success. while changing img.mfp img background color white changes shows white color , not me. need have whole background - black opacity 0.01 (if not mistaken)...i did not changed relevant code in css or js related magnific popup. can help? in forward solved: i have found out, problem "shadow image" behind picture, if anyone, change code .mfp-figure:after in css changed , works charm :) .mfp-figure:after { content:''; position:absolute; left:0; top:40px; bottom:40px; display:block; right:0; width:auto; height:auto; z-index:-1; box-shadow:0 0 8px rgba(0, 0, 0, 0.6); background:#444444; opacity: 0;

IFERROR function in MySQL -

is there function iferror in mysql. example: iferror(25/0,9) i tried on phpmyadmin said such function iferror not exist. appreciate help you can reach similar results ifnull: if answer not valid, defaults null. ifnull give alternative answer: your example (in case): select ifnull(25/0,9); gives result: 9

Parallel Computing in Matlab: can't find a network unit/folder -

i want run code on cluster of several pcs using current directory common logical unit, called q:\ . correct path folder is, say, \\myserver\myfolder so i'm starting parallel script with spmd cd('\\myserver\myfolder') end and, sure, put folder in "additionalpaths" in properties of cluster profile. to check whether functions , files reachable use spmd check('function1') end where "function1" function m-file in "myfolder". unfortunately spmd can't find function on every pc, on few of them, no apparent reason of choice. checked in issued computers if "system" user account (used matlabpool) has permission "\myserver\myfolder", has. anybody encountered similar situation? p.s: i'm using on every computer in cluster r2012a on windows 7 64bit. the 'additionalpaths' setting in cluster profile applies cluster jobs created , associated profile. job needs created using

importing XML data in Oracle DB -

i'm new in dbadministration , have been asked design db structure starting big (8gb) xml files. building structure, , finished. i'm testing importing of data xml tables. have stored content of file column in table, when try export 1 column value, have no results (and no errors). here code: create table testtable2 ( xml_file xmltype ) xmltype xml_file store securefile binary xml; insert testtable2 (xml_file) (select xmltype(bfilename('export_dumps','test001.xml'), nls_charset_id('we8iso8859p1')) dual ); select 'cd_uid' xmltable('xml/records/rec/uid' passing (select xml_file testtable2) columns cd_uid varchar2(4000)); the xml starts this: <?xml version="1.0" encoding="utf-8"?> <records xmlns="http://xxxxxxxxxxxxxx"> <rec r_id_disclaimer="yyyyy"> <uid>uid_number</uid> i have tried extracting data directly xml file, have stored

c# - Posting to a Web API from a Xamarin Android applicaion -

hi building xamarin android app connects web api. want post complex object api , receive object again. works when post object , receive bool value, not receiving complex object. works when use in windows mobile app. method in portable library. here post method: public static iresponseobject post<t, tout>(string url, t bindingmodel) { iresponseobject result; using (var client = new httpclient()) { var response = client.postasjsonasync(string.format("{0}{1}", _base, url), bindingmodel).result; if (response.statuscode == httpstatuscode.ok || response.statuscode == httpstatuscode.created) result = response.content.readasasync<successresponseobject<tout>>().result; else result = response.content.readasasync<badrequestresponse>().result; ((responseobject)result).status = response.statu

javascript - Jquery loop coding -

i have problem jquery loop. not stopped after reach 10th element, display 10 times every element. don't know problem. must add counter (z) after if clause, because want display 10 elements of filtered items (i if must not filter elements). the part of code: function(data) { $.each(data.query.results.tbody, function (i, e) { .. ... .... ...... if (x != '-') { var z; (z = 0; z < 10;) { $(".news").append('xxxxx'); z++ } } }); } ); var temp=''; (z = 0; z < 10; z++) { temp += "xxxx"; } $(".news").append(temp); append var outside loop. creare var temp, append data , after loop completes, post append: https://learn.jquery.com/performance/append-outside-loop/

java - Modifying try-catch statements to reduce clunky code -

i've been working sikulix try atdd. code works when i 1 working it. transferring below code else counter-productive irrespective of how comment code. int numoftries; while (!isfinishstage && numoftries != 3) { numoftries++; try { temp = new pattern("imgs/img1.png").similar(0.9f); s.wait(temp, 1); s.find(temp); s.hover(temp); isfinishstage = true; break; }catch (findfailed ff1) { try { temp = new pattern("imgs/img2").similar(0.5f); s.wait(temp, 1); s.find(temp); s.hover(temp); isfinishstage = true; break; } catch (findfailed ff2) { try{ temp = new pattern("imgs/img3");

sql - How to return value based on the last available timestamp if the exact time is unavailable? -

i trying return data in fifteen minute intervals. first thing thought this: select * mytable datepart(minute, timestamp) % 15 = 0 but there 2 problems approach. first there not data timestamp @ given minute, other there multiple data points @ given minute different second values. want have 1 row each fifteen minute group, @ :00, :15, :30, etc. this data recorded when changes, if don't have data point @ 12:30, example, take closest data point before , use value 12:30 , correct. so need able return timestamps @ :00, :30, etc along data record closest time. the data span years more shorter amount of time, days or weeks. expected output like: timestamp value 1/1/2015 12:30:00 25 1/1/2015 12:45:00 41 1/1/2015 1:00:00 45 i'm having trouble thinking of way in sql. possible? given fixed start time, need table of numbers add intervals to. if don't have table of numbers (which useful) quick way generate 1 on fly is with n1

c++ - Order of semantic actions using Spirit (with Phoenix reference) -

i'm building parser execute commands user may enter on command line. first part of command module belongs to, second part module's function call. attached first parser semantic action (with boost::phoenix::ref()) supposed store name of module in variable m_modulename . attached 2nd parser semantic action calls function printparameters former variable parameter. #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/home/qi.hpp> #include <boost/bind.hpp> #include <iostream> #include <string> namespace qi = boost::spirit::qi; namespace phoenix = boost::phoenix; void printparameters(const std::string & module, const std::string & command) { std::cout << "module name during parse: " << module << std::endl; std::cout << "command name during parse: " << command << std::endl; } template <type

javascript - ng-click not firing on a button click -

i facing weird error not able call function on ng-click when button clicked. this block of code ng-click not working delete button working edit button. <table ng-table="tableparams" class="table table-striped table-bordered pages_table"> <thead> <td><b>id</b></td> <td><b>image</b></td> <td><b>alt</b></td> <td><b>edit</b></td> <td><b>delete</b></td> </thead> <tbody> <tr ng-repeat="dat in newdata"> <td>((dat.id))</td> <td class="clients_review_admin_item"><img src=&quo

How to do awk comparison in TCL -

how use awk 'fnr==nr{a[$2];next}!($2 in a)' b in tcl. when ran using exec awk {fnr==nr{a[$0];next}!($0 in a)} m1 m2 > diff , giving out nothing in diff . i want compare m1 , m2 file , different should dump in diff .

python - matplotlib is not worked with qgis -

i build python plugin qgis n wanna use matplotlib plot graph while importing from matplotlib import pyplot plt and got error import error no module name backend_qt4agg please me solve this. have used qgis 2.8 , python 2.7.5 , centos i have used pip install matplotlib i have used library pygal got importerror no moduel name pygal though installed works fine command prompt not in application

Contact form php | EmailFrom and Bcc not showing up. -

im kind of new php need bit of , have had no luck anywhere else. i trying have person submits email sender, such when email comes through shows (unknown sender) or goes through server "testserver". want thier email address instead when unopened in inbox. client can click reply without having select email address. i have had problems setting cc , bcc fields. any ideas highly appreciated. heres html <form method="post" id="myform" name="myform"> <table width="250" border="0" cellspacing="0" cellpadding="0"> <tr> <td>name:</td> <td> <input type="text" name="name" id="name"></td> </tr> <tr> <td>number:</td> <td><input type="text" name="number" id="number">

java - open failed: EACCES (Permission denied) on SD card -

i can't use filewriter file on sd card have following permissions in manifest <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> i using following code file selected = new file("/storage/extsdcard/", "00 - copy.txt"); filewriter fw; try { fw = new filewriter(selected, false); fw.write(content); fw.close(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } i getting following in logcat, knowing /storage/extsdcard/00 - copy.txt exists. 07-14 14:50:48.722 18216-19903/tk.hasankassem.supererase w/system.err﹕ java.io.filenotfoundexception: /storage/extsdcard/00 - copy.txt: open failed: eacces (permission denied) 07-14 14:50:48.722 18216-19903/tk.hasankassem.supererase w/system.err﹕ @ libcore.io.iobridge.open(iobridge.java:456) 07-14 14:50:48.722 18216-19903/tk.hasank

javascript - Asp.net button event handler not working with validation? -

i can't seem know wouldn't work. have button js call open form in fancybox modal fine. i can validate data in form fine using asp.validation , throw messages in group div if required. when try submit form, doesn't anything. <asp:textbox id="miemailtextbox" runat="server" text="email address" cssclass="miemailfieldtextbox"></asp:textbox><asp:button id="miemailfieldsubmitbutton" runat="server" text="submit" cssclass="buttonpositive" onclientclick="return nextclick()" /> js open fancybox opens contents of div. function nextclick() { var emailaddress = $("[id$='_miemailtextbox']").val(); if (emailaddress != "email address" && emailaddress != "") { $("[id$='email']").val(emailaddress); $.fancybox({ 'width': 480, 'height':

apache - Why is my service provider limiting my htacess use? -

and in process making life more difficult? bluehost not let me use # no access seems #documentroot /public_html # access #directoryindex and docs need use # change document root using rewrite rules per bluehost document #rewriteengine on #rewritecond %{http_host} ^(www.)?foo.com$ #rewritecond %{request_uri} !^/web/ #rewritecond %{request_filename} !-f #rewritecond %{request_filename} !-d #rewriterule ^(.*)$ /web/$1 #rewritecond %{http_host} ^(www.)?foo.com$ #rewriterule ^(/)?$ web/index.php [l] i had problem before, looks have updated access can use direcotryindex . see bluehost documentation here. for documentroot have work around here . your web framework lists yet solution here . <ifmodule mod_rewrite.c> options -multiviews rewriteengine on #rewritebase /path/to/app rewritecond %{request_filename} !-f rewriterule ^ index.php [qsa,l] </ifmodule>

I want to insert a file into my SQL Server database -

my filecontent table has 4 columns: id, filename, filetype, [content] i want put unique constraint on filename column. what should insert query if want insert file specified location sql server database table?

php login script, give an error message if the name or password is incorrect -

how change script, displays error message if name or password incorrect? i'm new here in, can explain me <?php $username=$_post['username']; $password=md5($_post['password']); $login=$_post['login']; if(isset($login)){ $mysqli = new mysqli("localhost", "root", "tech112!", "ripper"); if ($mysqli->connect_errno) { echo "failed connect mysql: " . $mysqli->connect_error; } $stmt = $mysqli->prepare("select * login lower(`username`) = ? , password = ?"); $stmt->bind_param('ss', strtolower($username), $password); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $name = $row['name_login']; $user = $row['username']; $pass = $row['password']; $rank = $row['type_login']; if($use

PHP JSON value if exist then -

i have small json file , want check if "fullday":"no" in object. if true needs output no. how can php? { "calendar": { "title": "agenda punten", "agenda": [ { "id":1, "datum": "2015-07-13", "title": "titel agendapunt #1", "beschrijving": "dit een beschrijving", "fullday": "no" }, { "id":2, "datum": "2015-07-14", "title": "titel agendapunt #2", "beschrijving": "dit een beschrijving", "fullday": "yes" } ] } } thanks! try this.. <?php $json=&#

c# - Entity Framework Code First Composite Foreign Key on legacy DB -

so, i've been banging head few days , searching has led me close solution. i have legacy database thats far following ef's code convention , i'm using ef code first. this actual situation: (irrelevant fields ommited sake of brevity) [table("pedido")] public class pedido : ivalidatableobject { [key, column(order = 1), required] [databasegenerated(databasegeneratedoption.identity)] public int codigo { get; set; } [key, column(order = 2), foreignkey("dadoscliente"), required] public int cliente { get; set; } public virtual cliente dadoscliente { get; set; } public virtual icollection<materialpedido> dadosmateriaispedido { get; set; } } [table("material_pedido")] public class materialpedido : ivalidatableobject { [key, required, column(order = 1)] public int nrpedido { get; set; } // column relates pedido.codigo [key, required, column(order = 2), foreignkey("dadoscliente")]

linux - Why ARP requests a non-local address? -

i have linux virtual server 2 nics. eth0 <ip1> eth1 <ip2> arp_filter turned on , rp_filter set 2(loose mode). policy-routing configured following: table t1 default via <gw> dev eth0 src <ip1> 127.0.0.0/8 dev lo <lan> dev eth0 src <ip1> table t2 default via <gw> dev eth1 src <ip2> 127.0.0.0/8 dev lo <lan> dev eth1 src <ip2> ip rule add <ip1> table t1 ip rule add <ip2> table t2 after that, can ping both binding floatingips of <ip1> , <ip2> outside. ping -i eth1 <some_domain> dosen't work. tcpdump shows when ping eth1 outside, linux directly asks mac of outside address, incorrect because not in same lan . here tcpdump data: root@rm-2:~# tcpdump -i eth1 arp tcpdump: verbose output suppressed, use -v or -vv full protocol decode listening on eth1, link-type en10mb (ethernet), capture size 65535 bytes 17:53:08.696191 arp, request who-has 172.30.250.119 tell 172

oracle - Compare two delimited strings and return corresponding value in PL SQL -

i have 2 columns hashtag delimited value, i.e. email#web#telephone#sms#mms & 0#0#0#1#0 note each delimited value of second column matches corresponding delimited value in first column, i.e. email = 0 , web = 0 , telephone = 0 , sms = 1 etc. based on parameter, want return matching value of second column. i.e. incoming param = web#telephone#sms , value want return 0#0#1 . this need done in pl sql, , have no clue start, explains lack of sample code. any please? there couple of useful utility functions in oracle package called apex_util. (this package concerns oracle application express aka apex, can used anywhere). are: apex_util.string_to_table apex_util.table_to_string using string_to_table can convert delimited string table of values: declare v_table apex_application_global.vc_arr2; -- table type apex_util uses begin v_table := apex_util.table_to_string ('email#web#telephone#sms#mms', '#'); end; you have array 5 elements (

sql - Postgres Self Join query -

the db schema along sample data - country table | country | country code | -------------------------- abc ae bcd rw dest table | destcountry code | destcurrency code | totaldestamount | ---------------------------------------------------------- rw usd 3600 rw usd 13000 ae rwf 8880 ae usd 0 src table | srccountry code | srccurrency code | totalsrcamount | --------------------------------------------------------- ae usd 7 rw rwf 10 ae aed 399 ae usd 0 i want output - | mapping | srcamount| destamount | currency | ----------------------------------------------- abc-bcd 7 0 usd bcd-a

php - Error with mysql_fetch_object -

in log see next error mysql_fetch_object(): supplied argument not valid mysql result resource in mysql.class.php on line 37 here code line 37 function findpole1($id,$table){ mysql_connect($globals["hostname"],$globals["username"],$globals["password"]) or die(""); $result=mysql_db_query($globals["dbname"],"select * $table id='$id'"); //*****************line38******************************** $find=mysql_fetch_row($result); echo $find[2]; } and part of code mysql_fetch_object in same file static function query($sql,$default=0){ if ($default==1) { echo '<div style="border: solid 1px red">'.$sql.'</div>'; } $result=mysql_query($sql); $a=array(); while ($obj = mysql_fetch_object($result)) { $a[]=$obj; } return $a; } please me check error

Android OpenGL ES onFrameAvailable were not called? -

i use opengl es playing video, use android mediaplayer. works. running last few seconds. onframeavailable method not called anymore, , can heard voice of video. public void ondrawframe(gl10 paramgl10) { synchronized (this) { if (this.updatesurface) { this.msurface.updateteximage(); this.msurface.gettransformmatrix(this.mstmatrix); this.updatesurface = false; } } mydraw(); } public void onframeavailable(surfacetexture paramsurfacetexture) { this.updatesurface = true; requestrender(); } how should do? i had same problem videosurfaceview example. deleted line setrendermode(glsurfaceview.rendermode_when_dirty); and helped me

c# - Some problems with GetCreationTime function -

i have jpg file date of creation: 04/29/2014 in c# when write datetime dt = file.getcreationtime("c:\\users\\first\\desktop\\1.jpg"); i have dt 01/01/1601. can explain me why happen? that means file not exist. from documentation ; if file described in path parameter not exist, method returns 12:00 midnight, january 1, 1601 a.d. (c.e.) coordinated universal time (utc), adjusted local time. double check path.

Importing an old ActionBarSherlock into Android Studio project -

i importing old project eclipse android studio, , i'm stuck. need import actionbarsherlock in version 4.1 it, , don't know how. i've tried many solutions found on internet, meant newer versions of library. there no problems importing version 4.4 module, require 4.1, project uses extensively, , functions missing in newer versions. when try import using 'import module' "select modules import". is there way make work without reworking entire project? from here have gradle uri abs: https://github.com/jakewharton/actionbarsherlock-gradle-sample next: create new project in android studio, leave blank. choose supported sdk version blah blah , choose expected packagename. add dependencies new build.gradle. if have jar files copy them /lib folder in package hierarchy. copy code base eclipse project android studio project. make build see if works.

android - How to Store and Access CheckBox value after activity closed and Open in Java? -

i making simple android project. when open app show dialog message. dialog have 1 check box function don't show again. how this? how save value on local , access it? save value when checkbox checked sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(getbasecontext()); prefs.edit().putboolean("checked",true).apply(); for validation sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(getbasecontext()); boolean checked = prefs.getboolean("checked", false); if (checked){ //do not show } else{ //show }

csv - How to get the record count of columns matching with particualr value using awk command in linux -

i have display record count of columns matching "cd" input csv file. value cd appearing in second column in file input.csv. i trying below command not working expected. awk -f',' '$2=/cd/ { count++ } end { print count }' input.csv my input data: 1234,cd,xyz,abcd 01235,ab,kasdjk,aaaaa,fff 898,cd,laklksas,lsjdjdj,lkjsaj 111,cd,lkakskaks,jjjjjj 3455,00,ksajkjsa,kkkkk 59995,99,asllsal,99898,00,kkk,99 99,00,lkjjjsa,00,99,hhhh expected output: 3 if check count of "cd" 2 if check count of "00" please me. the operator match regexp ~ , not = . awk -f',' '$2 ~ /cd/ { count++ } end { print count }' input.csv if want exact match, not regular expression, use == , string: awk -f',' '$2 == "cd" { count++ } end { print count }' input.csv = assigning, not comparing.

Passing variable to the url in rails -

i passing variable that: new_sub_request_path(request_id:@request.id) so url: http://localhost:3000/sub_requests/new?request_id=1 in controller want assign request_id that: @sub_request = subrequest.new(sub_request_params) @sub_request.request_id = params[:request_id] and strong parameters defined: def sub_request_params params.require(:sub_request).permit(:description, :diagnos, :price, :payment, :request_id) end but after save have empty request_id attribute, seems not assigned. doing wrong? edit: inspecting parameters in console showed have attributes in form. edit2: def create @sub_request = subrequest.new(sub_request_params) @sub_request.request_id = params[:sub_request][:request_id] respond_to |format| if @sub_request.save format.html { redirect_to @sub_request, notice: 'sub request created.' } format.json { render :show, status: :created, location: @sub_request } else format.html {

PHP MYSQLI login Allow capital letter -

this script work, if use capital letter user not work, in database user name tom. , can login if use tom, tom not work. how can fix it? <?php $username=$_post['username']; $password=md5($_post['password']); $login=$_post['login']; if(isset($login)){ $mysqli = new mysqli("localhost", "root", "tech112!", "ripper"); if ($mysqli->connect_errno) { echo "failed connect mysql: " . $mysqli->connect_error; } $res = $mysqli->query("select * login username='$username' , password='$password'"); $row = $res->fetch_assoc(); $name = $row['name_login']; $user = $row['username']; $pass = $row['password']; $rank = $row['type_login']; if($user==$username && $pass=$password){ session_start(); if($rank=="2"){ $_session['mysesi']=$user; $_session['rank']=$rank; echo "

html - position:absolute h1 element overflowing right -

Image
i have container has of following css rules (taken chrome dev toolbar): border-bottom-color: rgb(85, 85, 85); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0px; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(85, 85, 85); border-left-style: none; border-left-width: 0px; border-right-color: rgb(85, 85, 85); border-right-style: none; border-right-width: 0px; border-top-color: rgb(85, 85, 85); border-top-style: none; border-top-width: 0px; box-shadow: none; box-sizing: border-box; color: rgb(85, 85, 85); display: block; font-family: 'open sans', helvetica, arial, sans-serif; font-size: 16px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: 100; height: 680px; line-height: 25.9200000762939px; margin-bottom: 0px; margin-left: 411.5px; margin-right: 411.5px; margin-top: 0px; max-width: 1080px; padding-bottom: 40px; padding-left: 60px; padding-

email - sending multipart mail in perl -

i trying send mail through perl script using net::smtp module.it works fine when send normal mail without attachment.i wont receive mail. use net::smtp; use mime::base64; use file::basename; use mime::base64 qw( encode_base64 ); use mime::base64 qw( decode_base64 ); @attachments = 'c:\users\ups7kor\desktop\scripts\commadnline\appending.pl'; $toaddress = '***'; $fromaddress = '***'; $servername = '***'; $boundary = 'end of mail'; $smtp = net::smtp->new($servername, timeout => 60) or print $failureloghandler ++$errrorcount.")error:could not create smtp object . \n\t please check smpt adress in $inifiledata{ini_smtp_server_name} of $inifilesection{ini_email} section "; $smtp->mail($fromaddress); $smtp->recipient($toaddress, { skipbad => 1 }); $smtp->data(); $smtp->datasend("to: $toaddress\n"); $smtp->datasend("from: $fromaddre

regex - How do I replace a newline in Atom? -

in atom, if activate regex mode on search-and-replace tool, can find newlines \n , when try replace them, they're still there. is there no way replace newline-spanning string in atom? looks atom matches newlines \r\n behaves inconsistently when replacing \n nothing. so newlines seem match \s+ , \r\n , , "half" of line-ending matches \n . if replace \n string, nothing happens line-ending, string appended next line if replace \r string, nothing happens @ all, cursor advances.

oracle - How to concatenate "similar" rows in SQL? -

now have following sql: select * ( select employee, template, trunc(a.from) date_from, sum(b.amounttotal) amnt_total, sum(b.amount) amnt table1 a, table2 b, table3 c ... group employee, template, trunc(a.from) ) pivot ( sum (amnt_total) date_from in ('01-may-2015' date1, '02-may-2015' date2, '03-may-2015' date3) ) and query result is: +------------+------------+--------+---------+---------+---------+ | employee | template | amnt | date1 | date2 | date3 | +------------+------------+--------+---------+---------+---------+ | kate | templa | 2 | | 12 | | | kate | templa | 4 | | | | | kate | templa | 7 | 16 | | 14 | | john | templb | 5 | 18 | 25 | | +------------+------------+--------+---------+---------+---------+ how transform data following form: +------

c# - How to pass multiple parameters to a view? -

i passing 2 list variables in actionresult below. public actionresult index() { list<category> cat = _business.viewallcat().tolist(); list<books> book = _business.viewallbooks().tolist(); return view(book); } when run code below error the model item passed dictionary of type system.collections.generic.list1[durgesh_bhai.models.category], dictionary requires model item of type system.collections.generic.ienumerable1[durgesh_bhai.models.books]. when using 1 list in actionresult working fine. i new mvc solution got create class hold required objects data members , pass object of class. i created class called data , assigned objects object of class , sent object model. or can use view bag class data { public list<category> cat {get;set;} public list<books> book {get;set;} public data() { this.cat = new list<category>(); this.book = new list<books>(); } } public actionresult inde

R remove multiple text strings in data.table -

i have vector of words remove data.table dt follows. wordstoremove <- c("simpson", "flander", "nahasapeemapetilon", "spuckler", "wiggum") dt <- structure(list(vid = c("simpsons", "flanders", "nahasapeemapetilons", "spucklers", "wiggums"), wr1 = c("homer simpson", "ned flanders", "apu nahasapeemapetilon", "cletus spuckler", "chief wiggum"), wr2 = c("bart simpson", "rod flanders", "manjula nahasapeemapetilon", "brandine spuckler", "ralph wiggum"), wr3 = c("marge simpson", "todd flanders", "sanjay nahasapeemapetilon", na, "sa

php - Allow to include a script but prevent file system access to it -

related search seem have rather unpopular problem. have server running plesk , multiple customers set separate web space each (no ssh access). further there "main" script repository put outside apache folders have single instance maintain , prevent direct access via http (instead using open_basedir allow customers include scripts). far, good. now want achieve noone should able view contents of included files (e.g. via file_get_contents). more want include/require: yes , access @ file-system level: no . possible above setup? or approach totally wrong in order achieve this? or there solution? best regards andy

No Results coming back from pouchdb-find query -

trying query on json below, getting empty array query, clues, first time have user pouchdb , pouchdb-find. groupid passed in parameter, create index wrapped in promise call, _db.find after index created. _db.createindex({ index: { fields: ['og_group_ref.und[0].target_id', 'type'] } _db.find({ selector: { "og_group_ref.und[0].target_id": groupid //type: 'student' } json "og_group_ref": {"und": [{"target_id": "49"}]}, any examples of complex selectors appreciated. selecting particular element in array not supported mango selector syntax. have move field out of array; sorry. edit: actually, hack, think og_group_ref.und.0.target_id , don't know if works in cloudant. might work in pouchdb.

php - Sorting tables in Codeigniter -

i've set way sort tables in codeigniter, can sort them based on 1 criteria. example, can order them alphabetically clicking on name, can't sort them clicking on price header. how can modify code table sorts data no matter on criteria select? here's snippets of code. model: function get_carti($sort_by, $sort_order) { $sort_order = ($sort_order == 'desc') ? 'desc' : 'asc'; $sort_columns = array('nume_autor, descriere, titlu, pret'); $sort_by = (in_array($sort_by, $sort_columns)) ? $sort_by : 'nume_autor'; $this->db->select ( 'b.descriere, a.nume_autor, a.id_autor, b.titlu, b.pret, b.image, b.id_carte' ); $this->db->from ( 'autori a' ); $this->db->join ( 'carti b', 'a.id_autor = b.id_autor' ); $this->db->order_by($sort_by, $sort_order); $carti = $this->db->get (); return $carti->result ();