Posts

Showing posts from August, 2014

mysql - How can I set current user as default value in the drop down list ASP.Net and VB.Net application -

in asp.net , vb.net web application form ; drop down list main contact holds list of names. list different different user logged in application. data populated select query database fields. (select query fetches data innerjoining 2 tables- employeruser table & user table. primary key of user table id foreign key in employeruser table named userid.) in front end asp.net coding is <div class="form-element"> <label> main contact (required) </label> <asp:dropdownlist id="commaincontact" runat="server" cssclass="chosen" enableviewstate="true" datatextfield="name" datavaluefield="id" /> </div> in end vb.net coding drop down list is commaincontact.datasource = localhelper.cachedemployeruserlist(localhelper.useremployerid)

java - jar file exception -

this question has answer here: how make runnable jar file? 3 answers i'm trying make runnable jar file of java application. each time follow steps of exporting application etc. created jar file application when run it, shows popup 'java virtual machine. java exception has occurred'. how can resolve issue? this correct, jar zip jar files fundamental archive files, built on zip file format , have .jar file extension just run it !

javascript - Can I Create a Single HighCharts Graph from Multiple Data Sources (Multiple GoogleSheets in this case) -

i’m trying use data multiple googlesheets produce single highchart graph. i’d without moving data 1 area of single spreadsheet, particularly want use drilldown option make difficult collect data together. thought pass columns array , reference array in data property of chart, i’m struggling 1 column 1 sheet. i have searched answers online, have not found relating highcharts getting data multiple sources. previous research: using googlesheets data array before creating chart: (removed link) - problem use 1 googlesheets reference here chart object sits inside data object. api documentation - (removed link) – tells me can access columns that’s not part i’m having problems with querying chart: (removed link) - have considered making hidden charts, interrogating data , making new charts those, seems long way round , i’m still not sure grab data need. using 2 googlesheets separate charts on same page: (removed link) have done this. please me understand how can access properties

ruby on rails - ActiveRecord How to verify a record has sucessfully saved on the database? -

i have learned hard way that model.save will return true if record passes validations, if there errors adding/updating model @ database end, still returns true. therefore using if model.save render 'yayy' else render 'error' end is not reliable. are there method has same functionality returns true if database updates or otherwise best way verify record has saved on database. (if matters using postgres database) check out activerecord::persistence . besides others, there such methods, new_record? , persisted? might looking for.

webview - Responsive website on different android devices like tablets and mobiles with a clear image quality? -

Image
i using webview display website url. actually, website contains text , images. when open app, automatically url accessed , can website directly. user can able click in home screen (on website) see products. have done program using webview. i able see website through android app on samsung mobile device through programmatically. not able see clear website on different android devices tablet , mobile devices through apk. there other solution? please can suggest or me? image not getting fitted webview when test on different android devices tablets. how websites work webview (with image , text alignment built in website using bootstrap) please can suggest / me? my code is, wv=(webview)findviewbyid(r.id.webview1); wv.setwebviewclient(new mywebviewclient()); string url="http://192.169.11.15/customercentric"; wv.getsettings().setjavascriptenabled(true); wv.loadurl(url); } private class mywebviewclient extends webviewclient { @override publ

c# - Empty GridView with dropdownlist having Datatable as it's datasource -

i've form shows empty gridview along add new button. have drop down list in column 1 gets populated database. based on selected dropdown list, query sql database , populate columns 2 , 3. i'm having trouble writing values of dropdown list datatable , add new row. worked when gridview had textboxes adding databound dropdownlist made lot complex. here code: <asp:gridview id="gridview1" runat="server" showfooter="true" autogeneratecolumns="false"> <columns> <asp:boundfield datafield="rownumber" headertext="row number" /> <asp:templatefield headertext="item number"> <itemtemplate> <asp:dropdownlist id="ddlitemnumber" runat="server" datasourceid="sdssubjects" datatextfield="item_num" datavaluefield="item_num" onselectedindexchanged="index_changed" autopostback=&qu

javascript - (Fixed by design change) Calculating heights to keep two columns equal height with jQuery on a responsive design site -

this no longer issue design has been changed, i'll leave question if other people have similar issue can discuss it. i working on site there section containing 4 elements 50% width, 3 of these elements images of different sizes , 1 text section (this section of text has 3 sets of content can changed through set of navigation buttons @ top. elements within section have divided 2 columns placed next eachother , have remain same height no matter how user re-sizes window. http://jsfiddle.net/jbalr019/1/ $(window).load(function() { $promotiontopleft = $('.promotion-top-left'); $promotiontopright = $('.promotion-top-right'); $promotioncenterleft = $('.promotion-center-left'); $promotioncenterright = $('.promotion-center-right'); $promotionleftcolumn = $('.left-column.grid-column'); $promotionrightcolumn = $('.right-column.grid-column'); var leftcolumnheight = $promotionleftcolumn.innerheight(); var rightcolumnheight = $promoti

c# - Applying a function within the select clause -

i have query (longish joins etc) , fields in select clause (all of of type decimal? ), want return null when db has them stored 0 . doing following work correctly: var q = o in .... .... select new { ... spot = o.spot == 0 ? null : o.spot, moneyness = o.strike / (o.spot == 0 ? null : o.spot), volatility = o.rate == 0 ? null : o.rate }; but prefer encapsulate check 0 in function. tried private static decimal? nullifzero(decimal? obj) { return obj == 0 ? null : obj; } and then var q = o in .... .... select new { ... spot = nullifzero(o.spot), moneyness = o.strike / nullifzero(o.spot), volatility = nullifzero(o.rate) }; but error: an unhandled exception of type 'system.invalidoperationexception' occurred in system.data.linq.dll additional information: not translate expression 'nullifzero(<>h__transparentidentifier0.o.spot)' sql

python - Insert separator only if didn’t insert one before -

i have template variable product_list , queryset of product objects; product objects, in turn, have one-to-many field of track objects (reverse mapped track , of course), possible empty. want create list of track s, grouped product s this: {% product in product_list %} {% if not first product tracks %} <li class="separator"></li> {% endif %} {% track in product.tracks %} <li>{{track}}</li> {% endfor %} {% endfor %} the question is, should write of if not first product tracks ? tried ifchanged product inserts separator on first iteration (as changes "" "someproduct" ). forloop.counter not usable here, possible first 2 products won’t have tracks. one workaround change product_list track_list this: track_list = track.objects.order_by('product__name') so can indeed use ifchanged . doable in case, i’m still interested in solution first method. you should compose co

Bootstrap row of col-sm-4 leaving a blank space at col-xs-6 -

i using bootstrap layout, having problem when going 3 columns @ col-sm-4 wanted 2 columns @ col-xs-6, it's leaving blank space after third item. idea how can solver, layout goes 3 columns 2 in xs size? /** style illustrate issue */ .red { background-color: red; } .green{ background-color:green; } .blue{ background-color:blue; } .sample { min-height: 100px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <div class="col-sm-4 col-xs-6 sample red">1</div> <div class="col-sm-4 col-xs-6 sample blue">2</div> <div class="col-sm-4 col-xs-6 sample green">3</div> your colum

php - Accessing Parent Array Names -

i have got app returning array: http://pastebin.com/3vkcjlmt i'm trying list data on laravel view as: fab0003 - accessory stand short section -- mac0010 -- cut0010 fab0004 - accessory stand long section -- mac0011 -- raw0010 but can't life of me figure out how access pieces of information beginning fab! current view code this: @foreach ($product->fabrications $items) @foreach ($items $item) <tr> <td></td> <td>{{ $item->part_number }}</td> </tr> @endforeach @endforeach i grateful if out php noob has wasted hours on :( try - @foreach ($product->fabrications $key => $items) $key parent key. note : should array key.

upload array of items to json API ios -

i have ios app can upload data such string json , phpmyadmin database. [[api sharedinstance] commandwithparams:[nsmutabledictionary dictionarywithobjectsandkeys:@"uploaddata", @"command", titletext.text, @"title", nil] oncompletion:^(nsdictionary *json) { //completion nslog(@"json: %@", json); if (![json objectforkey:@"error"]) { //success [[[uialertview alloc]initwithtitle:@"success!" message:@"your data has uploaded" delegate:nil cancelbuttontitle:@"done" otherbuttontitles: nil] show]; } else { //error, check expired session , if - authorize user nsstring* errormsg = [json objectforkey:@"error"]; [uialertview error:errormsg]; if ([@"authorization required" compare:errormsg]==nsorderedsame) { [self performseguewithidentifier:@"showlogin" sender:nil]; } } }]; however, add array of

php - how to send multiple ajax request and process the multiple request -

below ajax code perform subjected action implemented in manner of elaboration instead of simple one. here implemented separate code each ajax request , response. please see below code: <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery- 1.7.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#country").change(function(){ var country=$("#country").val(); $.ajax({ type:"post", url:"getstate.php", data:'typeid='+country, success:function(data){ $("#state").html(data); } }); }); }); </script> <script type="text/javascript"> $(document).r

javascript - React.js communicate with state object from outside component -

using react dnd lib: const itemdroptarget = { acceptdrop(component, item) { window.alert('you dropped ' + item.name + '!'); } }; const container = react.createclass({ mixins: [dragdropmixin], getinitialstate() { return { items: [] }; }, statics: { configuredragdrop(register) { register(itemtypes.item, { droptarget: itemdroptarget }); } } }); wondering how can add new "dropped" item react component's state object, acceptdrop function? what's usual approach kind of thing react? the normal way using callbacks , create function inside parent component , put props when call child.

html - Styling selected option -

this question has answer here: css :selected pseudo class similar :checked, <select> elements 3 answers pretty self explaining, need style option selected user. possible without javascript? simple example: html: <select multiple> <option class="opt1" value="">option 1</option> <option class="opt2" value="">option 2</option> </select> css: .opt1[selected]{ background-color: red; } .opt2{ background-color: green; } js fiddle example try . <style> .your-select option:checked {background:#333;padding:20px;width:100px;border:3px solid #f00} </style> <select multiple class="your-select"> <option class="opt1" value="">option 1</option> <option class="opt2" value=""

json - REST API status as integer or as string? -

me , colleague working on rest api. we've been arguing quite lot whether status of resource/item should a string or integer ---we both need read, understand , modify resource (using separate applications). general subject, google did not settle argument. wonder experience , way better. for example, let's have job resource, accesible through uri http://example.com/api/jobs/someid , has following json representation stored in nosql db: job a: { "id": "someid", "name": "somename", "status": "finished" // or "created", "failed", "compile_error" } so question - maybe should more following? job b: { "id": "someid", "name": "somename", "status": 0 // or 1, 2, 3, ... } in both cases each of have create map, use make sense of status in our application logic. myself leaning towards first one, far more readable... c

android - Main Activity Instance sometimes Throw Run Time Exception "LinphoneActivity not instantiated yet" -

i make application linphone library, have code throw exception in mainactivity : private static mainactivity instance; public static final boolean isinstanciated() { return instance != null; } public static final mainactivity instance() { if (instance != null) { return instance; } throw new runtimeexception("linphoneactivity not instantiated yet"); } method instance used in activity (incomingcallactivity , contact data activity) incoming call activity launch if there call phone if (!linphonemanager.getinstance().acceptcallwithparams(mcall, params)) { // above method takes care of samsung galaxy s toast.maketext(this, r.string.couldnt_accept_call, toast.length_long).show(); } else { if (!mainactivity.isinstanciated()) { return; } final linphonecallparams remoteparams = mcall.getremoteparams(); if (remoteparams != null && remoteparams.get

oop - Using an interface/Inheritance as a marker when concrete type represents different choices of which there can only be one -

quite mouth-full of question oo principle i've struggling with. lets have e-commerce app , there concept of payment method, examples creditcard, paypal, apple pay etc. user has choice of payment method select need present them in list on screen , depending on selection used drive ui, presenting different text/images/interactions serialised differently payment request on wire. here code: public class paypalpayment : paymentmethod { public string token; public string string; } public class creditcardpayment : paymentmethod { public address address; public creditcard creditcard; } interface paymentmethod { } public class booking { public paymentmethod paymentmethod; //generic object //or public paypalpayment paypalpayment; public creditcardpayment creditcardpayment; } so in booking class can either have generic payment object referred interface cant underlying type without casting sucks, in reality them don't share common proper

c# - Common output directory, Web Applications and IIS Express -

Image
i have changed output path projects use same location. i.e: my asp.net web api projects have stopped working when running them in debug using iis express. it seems iis express pointing existing web application project directory: should not pointing ..\build\bin\debug common output directory? how configure this? unfortunately, there no clean way this. security reason, iis requires use 'bin' folder right under web project folder output directory. it still possible achieve goal though. see here .

The maximum malloc space in Visual Studio C++ -

i writing simulation program, , define struct node, of 544 bytes. in program need malloc millions of nodes. each time when maximum number reaches 3 million, newnode=malloc(node) will return null. takes 250mb of memory. can tell me why happens , how solve problem? as c++ use new() http://www.cplusplus.com/reference/new/ if allocation not finished. new should throw exception. need after print/debug exception , google it. maybe help check gcc if problem same. if not has visual studio compiler specific problem (i doubt that)

c++ - Handle exception as a parse error in bison -

how catch en exception thrown upon executing rule in bison like foo : bar { $$ = new bar($1); } the bar constructor throws std::invalid_argument exception if it's argument inappropriate. catch exception , raise compilation error, native error message like input:42.10: bad value `baz' bar also there lot of kind of rules, great handle not within rule itself, somewhere in parser. if using lalr1.cc , c++ skeleton of bison, there limited support exceptions: if throw yy::parser::syntax_error , exception caught syntax error, duly reported, , parser enters error recovery mode. that's using yyerror . if throw else, whole parsing aborted, stack cleaned, , exception rethrown. that's yyabort . so if you'd errors caught rule-reduction should throw specific exception, see c++ parser interface documentation of bison .

python - Pytest - Error No Module Named Sqlalchemy -

i tried import sqlalchemy pytest file when tried run shows error, though have installed sqlalchemy. new.py:1: in <module> import sqlalchemy e importerror: no module named sqlalchemy my code : import pytest import sqlalchemy the code when importing sqlalchemy. how fix it? in advance

Not getting the option to select schema in apex while loading data -

Image
i trying load data through excel sheet in version 4.2 using options : go sql workshop->utilities->data workshop ->data load but not able select schema .please @ screenshot , help thanks reply found out issue: there 2 options in data workshop- a)new table b)existing table had change option in data workshop new table existing table.

java - How to skip a print statement in loop -

i have 2 classes named test1 , test2. class test1{ public void exe1(){ system.out.println("execute 1 time"); system.out.println("execute iterations"); system.out.println("execute last time"); } } class test2{ public statuc void main(string args[]){ test1 ts = new test1(); for(int i=0 ; i<=3;i++){ ts.exe1(); } } } the ouput of result : execute 1 time execute iterations execute last time execute 1 time execute iterations execute last time execute 1 time execute iterations execute last time is possible in java output should : execute 1 time execute iterations execute iterations execute iterations execute last time i mean 1st print statement should execute @ 1st time , number of iterations may print , @ end last print statement should execute. public void exe1(int i){ if(i==0) system.out.println("execute 1 time"); if(i==3) system.out.prin

php - array is converted as string in PDO -

below query: $key = array(1,2); $in = join(',', array_fill(0, count($key), '?')); $statement = $pdo->prepare("select * posts posts.subid in (".$in.") , posts.pricing=? , posts.poscode=? order posts.poscode desc limit 60"); $result = array_merge($key, array($rate,$postcode)); $statement->execute($result); when replace $key = array(1,2); $key = array($key); query fetches data first id whereby assume converts array string. $key holds value 1,2 in array shown below: $a=$data['sub']; $key0=array(); foreach($a $v=>$k) { $key0[]=$v; } $key2=implode(',',$key0); $key = array($key2); how make pdo understand $key holds array value , not string? i solve problem using named placeholders. don't ? stuff. need placeholder every value of in. see sample code: $key = array(1,2); $pricing = "somepricing"; $postcode = "somepostcode"; $bindings = array(); $bindings[] = array

Can SPSS treat a collection of Nominal Variables as one variable? -

i have lot of movie data imdb , i'm in middle of cleaning data , making 1 row = 1 movie database has multiple records single film. i've restructured data single 'country' variable multiple cases single film, set of 29 country columns. single film may have 29 countries affiliated (most have 1 or 2). i plan simple descriptive statistics , expected frequencies, perhaps correlations other variables genre etc. is possible have spss treat 29 variables single variable? doesn't matter of country variables country present in, present in 1 of them. example might want find indian films, , ask spss check each row, whether 'india' in 1 of country variables , return row if present in of them. is possible, or need manually instruct spss list of or commands whenever run query. there 2 types of multiple response sets: multiple dichotomy, 29 yes/no variables describe, , multiple category, in have list of arbitrary categories. see mrsets command details.

java.lang.SecurtiyException at unsigned jar's -

i'm facing securityexception @ runtime: java.lang.securityexception: class "util.opennitodtw"'s signer information not match signer information of other classes in same package @ java.lang.classloader.checkcerts(classloader.java:952) where util.opennitodtw own class wich using 3rd party jar. according this jar's have signed using same certificate. but neither of jar signed , checked using jdk's jarsigner -verify. what exectly causing problem? you using package name that's used else. if have signed work , yours unsigned, you'll error. purpose of error protect signed content being added others without consent of original signer. signing saying "this code me, , can trust me". if add new classes package, mean stuff no longer trusted, case prevented. think of package name trademark. start reverse order of company's web site. example org.apache.commons.codec starts org.apache indicating it's same group runs

How to open extarnal url in default browser and all internal links in WebView Android? -

i use logic every internal link contains 'myurl' string should open in webview , other external link in default browser. package com.package.webviewapp; import android.app.activity; import android.os.bundle; import android.webkit.webview; import android.webkit.webviewclient; public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); webview webview = (webview) findviewbyid(r.id.webview); webview.setwebviewclient(new mywebviewclient()); string url = "http://myurl.com"; webview.getsettings().setjavascriptenabled(true); webview.loadurl(url); } } class mywebviewclient extends webviewclient { @override public boolean shouldoverrideurlloading(webview view, string url) { if(url.contains("myurl")){ // cleverer , use regex view.loadurl(url

android - How to keep the status of the ViewHolder in RecyclerView -

Image
i have recyclerview includes few grid cells. there textview above click me button. i'll show example, name @ textview when button clicked. problem me text inside textview not persistent. here code in mainactivity: private void initializedata(){ persons = new arraylist<>(); persons.add(new person("name 1", "23 years old", r.drawable.a)); persons.add(new person("name 2", "25 years old", r.drawable.b)); persons.add(new person("name 3", "35 years old", r.drawable.c)); persons.add(new person("name 4", "35 years old", r.drawable.c)); persons.add(new person("name 5", "35 years old", r.drawable.c)); persons.add(new person("name 6", "35 years old", r.drawable.c)); persons.add(new person("name 7", "35 years old", r.drawable.c)); persons.add(new person("name 8", "35 years old", r.drawab

android - How to play an alarm sound when 'no interruptions' is set in lollipop? -

i able play tune in app, when volume off so: audiomanager amanager = (audiomanager) getsystemservice(context.audio_service); int maxvolume = amanager.getstreammaxvolume(audiomanager.stream_alarm); amanager.setstreamvolume(audiomanager.stream_alarm, maxvolume, 0); ... in alarm clock app obvious reasons. unfortunately, in lollipop no longer works when 'no interruptions, not alarms' turned on: phone stays silent. however, stock alarm clock still works 'interruptions off', , wonder differently.

php - Resizing/Cropping Image to adjust into layout -

i'm having issue re-sizing / scaling thumbnails in desired layout. able generate thumbnails here's code crop/resize. $filename = $key.$_files["files"]["name"][$key]; $filetmp = $_files["files"]["tmp_name"][$key]; $filetype = $_files["files"]["type"][$key]; $filesize = $_files["files"]["size"][$key]; $fileinfo = getimagesize($tmp_name); $filewidth = $fileinfo[0]; $fileheight = $fileinfo[1]; // gets file extension $fileextension = pathinfo($filename, pathinfo_extension); $microtime = preg_replace('/[^a-za-z0-9]/', "", microtime()); $filepath = "../static/products/".$microtime.".".$fileextension; $filepath_thumb = "../static/products/thumbs/".$microtime.".".$fileextension; $filepath2 = "/static/products/".$microtime.".".$fileextension; move_uploaded_file($filetmp,$file

visual studio 2012 - Can't copy files in deployee folder vb.net website -

Image
i have problem deploying website. while trying publish website vs creates folder doesn't copy files. never faced issue before.i didn't change in vs any solving issue?

php - Video uploading with Codeigniter and mysql -

i tried many ways upload videos through website. don't know why, can save images, text files etc. not possible save videos folder , database. here view. <form action="<?php echo base_url();?>galleries/add_vdo" method="post" enctype="multipart/form-data"> <div class="input-group"> <input type="text" class="form-control" placeholder="enter title" name="vdo_title" id="vdo_title"> <textarea class="form-control" placeholder="about video" name="vdo_desc" id="vdo_desc"></textarea> <input class="" name="ur_vdo" id="ur_vdo" type="file"> <input class="btn btn-info" type="submit" name="submit" value="add now"/> <!--<button cl

php - Ldap Timestamp converting issue -

here code following convert ldap timestamp date format. here: https://ideone.com/kfgd32 i comparing output this: http://www.epochconverter.com/epoch/ldap-timestamp.php my output showing different actual ouput showned in above link. update: followed below code still showing me wrong minutes, here: https://ideone.com/4gcj3f compare output this: http://www.epochconverter.com/epoch/ldap-timestamp.php wrong date formatting: m stands month, not minute. m numeric representation of month, leading zeros 01 through 12 http://php.net/manual/en/function.date.php

node.js - combinedStream not same checksum on join parts of chunk nodejs -

i using nodejs concatinate multiple chunks of 1 mb files. linux cat command works: cat /tmp/part.* >> /tmp/full using following gives other sha256 checksum: //at point /tmp/full non existing. for(var = 0; &lt; 5; i++) { var combinedstream = combinedstream.create(); combinedstream.append(fs.createreadstream("/tmp/part."+i)); combinedstream.pipe(fs.createwritestream("/tmp/full", {'flags': 'a'})); } i tested spawnsync, strange error: var cat = require('child_process').spawnsync("/bin/cat", ["/tmp/part.1", ">>", "tmp/full"]); console.log(cat.status ); console.log(cat.stderr.tostring()); console.log(cat.error); output: 1 /bin/cat: >>: no such file or directory /bin/cat: tmp/full: no such file or directory undefined what doing wrong?

c++ - Launching the program from Visual Studio debugger is faster than launching it from outside -

summary: i saw when ran program visual studio (f5), pair of multiplications took around: x64: 3.8~ ms win32: 4.5~ ms however when ran outside took: x64: 6.59~ ms win32: 6.62~ ms does have idea why happening? more info: i wanted test matrix multiplication speed of glm library , iterating on number of them hash map, vector , array. (to calculate transformation matrices rendering) so, using queryperformancecounter, tested 50000~ multiplication pairs 1000 times average timing. (default visual studio 2013 empty project release configuration) normally 1 expect program faster when ran outside of visual studio, tried again setting program priority programmatically, made no difference. to give idea example loop looks this: timer.start(); (int j = 0; j < 1000; j++) { (int = 0; < objectsvector.size(); i++) { if (objectsvector[i]->mmeshrefid > 0) { results[i].worldtransformationmatrix = ob

c# - Finding/editing exact entry in file -

i'm trying make changes file , appear need regex. have following code: public delegate string updateaction(string contents); public static void updatefile(string file, updateaction m) { string contents = ""; using (streamreader reader = new streamreader(file)) contents = reader.readtoend(); contents = m(contents); using (streamwriter writer = new streamwriter(file)) writer.writeline(contents); } public static void updateproperty(string file, string objectname, string property, string value) { updatefile(file, delegate(string contents) { string propertypattern = "(\"" + property + "\".*?\")(.*?)(\")"; string pattern = "(\"?)" + objectname + "(\"?)(\n|\r|\r\n)(.*?){(.*?)}"; regexoptions options = regexoptions.singleline | regexoptions.multiline | regexoptions.ignore

sql server - Regular expressions in TSQL -

in cells of column e_vis_name have organization structure divisions divided \ symbol, e.g. moscow\direction yaroslavl\sales omsk\commercial center\sales i need cut after first \ symbol following result: moscow yaroslavl omsk how can it? you can use combination of left , charindex this: select left(colname, charindex('\', colname)-1) table edit: in case don't have \ symbol, if want grab whole column instead can this: select case when charindex('\', colname) > 0 left(colname, charindex('\', colname)-1) else isnull(colname, '') end table this says, "if there \ , take characters point, otherwise take whole column. , if column null set empty string." i'm sure can adapt purposes.

android - java.lang.NoClassDefFoundError -

i getting java.lang.noclassdeffounderror error constant_country class, exist inside com.mi.uvite.model package. class exist still says noclassdeffounderror . how can overcome issue? java.lang.noclassdeffounderror: com.mi.uvite.model.constant_country @ com.mi.uvite.db.midatabasehandler.createcountrytable(midatabasehandler.java:911) @ com.mi.uvite.db.midatabasehandler.oncreate(midatabasehandler.java:632) @ android.database.sqlite.sqliteopenhelper.getdatabaselocked(sqliteopenhelper.java:252) @ android.database.sqlite.sqliteopenhelper.getreadabledatabase(sqliteopenhelper.java:188) @ com.mi.uvite.db.midatabasehandler.rowcount(midatabasehandler.java:570) @ com.mi.uvite.backgroundintentservice$1.onresponse(backgroundintentservice.java:110) @ com.mi.uvite.backgroundintentservice$1.onresponse(backgroundintentservice.java:67) @ com.android.volley.toolbox.stringrequest.deliverresponse(stringrequest.java:60) @ com.an

javascript - How to display more posts -

i receiving json object contains posts wordpress account, getting around 15 posts, should more amount ? the json looks this { id: 4164, title: "24 horas non-stop con marco carola", status: "publish", type: "post", author: { id: 11, username: "vilma quiros", name: "vilma quiros", first_name: "vilma", last_name: "quiros", nickname: "vilma quiros", slug: "vilma-quiros", url: "", avatar: "", description: "", registered: "2015-04-16t07:04:04+00:00", meta: { links: { self: "http://urbanetradio.com/wp-json/users/11", archives: "http://urbanetradio.com/wp-json/users/11/posts" } } }, content: "<p class="p2"><a href="http://urbanetradio.com/wp-content/uploads/2015/05/prueba-1.png"</p> <p><iframe src="https://www.youtube.com/embed/av6namjdyne"

ruby on rails - AWS OpsWorks Environment what is it the "my_node" and how add it to my Custom Chef JSON -

i running rails application in aws opsworks environment i try add "whenever" gem rails app , saw there "whenever cookbook". whenever cookbook one of requirements is: "include whenever in node's run_list:" { "name":"my_node", "run_list": [ "recipe[whenever]" ] } my question: "my_node" , how add custom chef json { "deploy": { "todoapp": { "database": { "adapter": "mysql2" } } } } thank, izik.

Matlab programming dealing with matrix -

Image
i trying out 1 of matlab programming question. question: write function called hulk takes row vector v input , returns matrix h first column consist of elements of v, second column consists of squares of elements of v, , third column consists of cubes of elements v. example, if call function likes this, = hulk(1:3) , [ 1 1 1; 2 4 8; 3 9 27 ]. my code: function h = hulk(v) h = [v; v.^2; v.^3]; size(h) = (n,3); end when test code using a = hulk(1:3) , throws error on console. your function made error argument(s) 0 am doing incorrect? have missed anything? remove line size(h) = (n,3); , add line h = h'; total code should follows function h = hulk(v) h = [v; v.^2; v.^3]; h = h'; end your code giving error in matlab editor on size(h) = (n,3); line that's why should use matlab editor

c++ - I'm confused how this execvp() is handled in this sample function which uses fork() to clone a process -

i have following function book titled "advanced linux programming". int spawn (char* program, char** arg_list) { pid_t child_pid; /* duplicate process. */ child_pid = fork (); if (child_pid != 0) /* parent process. */ return child_pid; else { /* execute program, searching in path. */ execvp (program, arg_list); /* execvp function returns if error occurs. */ fprintf (stderr, “an error occurred in execvp\n”); abort (); } } but i'm confused that, in cases ls executed successfully, error not printed, in case fails, prints error put in line following it. my question line fprintf (stderr, “an error occurred in execvp\n”); after execvp() function, , expected executed after execution of execvp() finishes, not case, , executed if execvp() encounters error. seems function spawn() finishes executes execvp() successfully. right? you can have @ manpage execvp , says: the exec() family of functions

mysql - Can't get PHP PDO and OOP classes to work -

i trying learn how use php pdo object oriented programming. i have tried following these 2 tutorials: http://culttt.com/2012/10/01/roll-your-own-pdo-php-class/ http://culttt.com/2012/09/24/prevent-php-sql-injection-with-pdo-prepared-statements/ but can't on either of them work. the second 1 gives download link pre-written wrapper class class.db.php http://www.imavex.com/php-pdo-wrapper-class/ using pre-written wrapper class , trying simple tutorial.php (credentials changed): // include database class include("class.db.php"); // connect database $db = new db("mysql:host=localhost;dbname=my-db-name", "my-username", "my-password"); $results = $db->select("ad_publication"); print_r($results); the above shows blank page. i know there nothing wrong pre-written class , text of above example copied directly out of tutorial , comments full of , praise. i know there nothign wrong credentials works fine: try {