I have a program that when I press a pushbutton it loads the options of my combombox, I have three, but for a unknown reason only two works. This function read a .txt file, and then put the strings in the combobox. I tried with addItem() and addItems(), made function again and it didn't work. The function read another two combobox and then loads the options.This is the function:
def cargar_combobox_flujos2(self,event):
anho = int(self.ui.combobox_anho.itemText(self.ui.combobox_anho.currentIndex()))
mes_input = self.ui.combobox_mes.itemText(self.ui.combobox_mes.currentIndex())
dic = {'Enero': 1, 'Febrero': 2, 'Marzo': 3, 'Abril': 4, 'Junio': 5, 'Julio': 7, 'Agosto': 8, 'Septiembre': 9,
'Octubre': 10, 'Noviembre': 11, 'Diciembre': 12}
mes = int(dic.get(mes_input))
lista_ssee=[]
nombre_txt='Graficos Flujos/lista_cbbx_'+str(anho)+'_'+str(mes)+'.txt'
if os.path.isfile(nombre_txt)==True:
archivo = open(nombre_txt, 'r')
c=archivo.read()
lista=c.split(',')
for i in lista:
lista_ssee.append(i)
archivo.close()
option_barras= self.ui.comboBox_barras_CMg2.count()
if option_barras > 1:
self.ui.comboBox_barras_CMg2.clear()
for barra in lista_ssee:
self.ui.comboBox_barras_CMg2.addItems(barra)
Related
Error message
Traceback (most recent call last):
File "pred.py", line 134, in
output = model(data)
Runtime Error: Expected 4-dimensional input for 4-dimensional weight [16, 3, 3, 3], but got 3-dimensional input of size [1, 32, 32] instead.
Prediction code
normalize = transforms.Normalize(mean=[0.4914, 0.4824, 0.4467],
std=[0.2471, 0.2435, 0.2616])
train_set = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
normalize,
])
model = models.condensenet(args)
model = nn.DataParallel(model)
PATH = "results/savedir/save_models/checkpoint_001.pth.tar"
model.load_state_dict(torch.load(PATH)['state_dict'])
device = torch.device("cpu")
model.eval()
image = Image.open("horse.jpg")
input = train_set(image)
train_loader = torch.utils.data.DataLoader(
input,
batch_size=1,shuffle=True, num_workers=1)
for i, data in enumerate(train_loader):
#input_var = torch.autograd.Variable(data, volatile=True)
#input_var = input_var.view(1, 3, 32,32)
**output = model(data)
topk=(1,5)
maxk = max(topk)
_, pred = output.topk(maxk, 1, True, True)
Am getting this error when am trying to predict on a single image
Image shape/size error message
Link to saved model
Training code repository
Plz uncomment this line #input_var = input_var.view(1, 3, 32,32) so that your input dimension is 4.
I assume that your no. of input channels are 3 if its one then use input_var = input_var.view(1, 1, 32,32) if gray scale
Instead of doing the for loop and train_loader, solved this by just passing the input directly into the model. like this
input = train_set(image)
input = input.unsqueeze(0)
model.eval()
output = model(input)
More details can be found here link
Someone of you know how find the signification of trap for an OKI printer (B512) ?
I check the manual, and I search on google but I found anything.
Thank you !
Here is what I could find to interpret the return of the printer status in SNMP :
okiPrinterOnline = 1,
okiPrinterOffline = 2,
okiNoPrinterAttached = 3,
okiPrinterTonerLow = 4,
okiPrinterPaperOut = 5,
okiPrinterPaperJam = 6,
okiPrinterDoorOpen = 7,
okiPrinterError = 16,
I am attempting to learn to script as I develop a project so please forgive me if I ask this question incorrectly.
I have created an AutoSort script for a google sheets document to sort a list of players by "Weight". It works fine until I add the following formula. Once I add this formula, my data is to be sorted by Column 7, largest to smallest and doesn't completely. The odd part of this is that the players that are out of order are listed as Substitutes.
The way this sheet works.
The Match Tool tab is where players are selected from Data Validation cells.
The Data Validation list comes from the MR1 Tab.
The MR1 tab gets it list based on an importrange defined in the MRTool.
This comes from a larger document and I've extracted the vital parts to make the error happen. I've tried to run a bare-bones version with only text and the AutoSort script and it sorts correctly. I have also tried changing which column the AutoSort looks in and it works correctly.
The formula that stops the script from working:
=if(or(C10="",C10=". Blank"),"",iferror(index('MR1'!$B$8:$H$87,(match(C10,'MR1'!$N$8:$N$87,0))),"Player Not Found"))
The Script for the AutoSort:
var roster = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Match Tool");
var range1 = roster.getRange("B10:K59");
var range2 = roster.getRange("N10:W59");
range1.sort( [{ column : 7, ascending: false}, { column : 11, ascending: false}] );
range2.sort( [{ column : 19, ascending: false}, { column : 23, ascending: false}] );
}
function SortLeft() {
var roster = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Match Tool");
var range1 = roster.getRange("B10:K59");
range1.sort( [{ column : 7, ascending: false}, { column : 11, ascending: false}] );
}
function SortRight() {
var roster = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Match Tool");
var range2 = roster.getRange("N10:W59");
// It seems that column numbers are always sequential from the first one, even if you are addressing a range. Hence using 14/18 here instead of 4/8
range2.sort( [{ column : 19, ascending: false}, { column : 23, ascending: false}] );
}
function SortSelection() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getActiveRange();
var firstcol = range.getColumn();
var lastcol = range.getLastColumn();
//Before sorting, this code checks to make sure that Clan through Combined heroes is selected on one side or the other. If not, an error appears.
if (firstcol == 2 && lastcol == 11 ) { range.sort( [{ column : 7, ascending: false}, { column : 11, ascending: false}] )} //&& lastcol == 11
else if ( firstcol == 14 && lastcol == 23 ) { range.sort( [{ column : 19, ascending: false}, { column : 23, ascending: false}] )} //&& lastcol == 23
else { SpreadsheetApp.getUi().alert('You can only sort selections that include all 8 data columns, from Clan to Notes.');}
}
function onEdit(e){
var roster = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Match Tool");
var autosort = roster.getRange(6, 13).getValue();
var range1 = roster.getRange("B10:K59");
var range2 = roster.getRange("N10:W59");
// if('B3' === GWL) {
// SpreadsheetApp.getActiveSheet().getRange('K2').setValue('40');
// }
// test if K2 (war size) was modified
if (e.source.getActiveSheet().getName() == "Match Tool" && e.range.rowStart === 6 && e.range.columnStart === 13) {
moveToSub();
}
//preform autosort if on
if ( autosort == "On" ){
range1.sort( [{ column : 7, ascending: false}, { column : 11, ascending: false}] );
range2.sort( [{ column : 19, ascending: false}, { column : 23, ascending: false}] );
}
}
I expect players to be sorted by column 7 (column G) descending and then column 11 (Column K) descending. What I'm getting is certain players not sorted correctly.
I am getting - 132, 131, 131, 113, 111, 132, 113, 90, 88, 87, 86.
I should see - 132, 132, 131, 131, 113, 113, 111, 90, 88, 87, 86.
Thank you for taking the time to help me.
After some help from a friend, we realized the problem wasn't anything to do with the script on this page, it was how the data was entered on the sheet the data was imported in from. Some numbers were entered as numerals while others were entered in as text. By changing the text to numerals, the script performed as expected.
So the moral of the story is, check to make sure the data being sort is of the same type.
For instance, how can I construct a list consisting of all the digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
You can construct it with val xs = ($list {int} (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)).
Make sure you specify the correct memory allocation functions by passing -DATS_MEMALLOC_LIBC to the compiler when using this code.
If you compile to JavaScript via atscc2js, then you need to construct
the list in the following manner:
val ds =
0::1::2::3::4::5::6::7::8::9::nil{int}()
// end of [val]
It also works for targeting C.
There are also combinators for this sort of things. For instance,
val ds = (10).list_map(TYPE{int})(lam(i) => i)
val ds = list_tabulate_cloref<int>(10, lam i => i)
You can find special literal on emacs mode:
https://github.com/githwxi/ATS-Postiats/blob/653af81715cf6bfbd1d2cd5ece1e88c8c3912b4a/utils/emacs/ats2-mode.el#L287
(defvar ats-special-keywords
'("$arrpsz" "$arrptrsize" "$delay" "$ldelay" "$effmask" "$effmask_ntm" "$effmask_exn" "$effmask_ref"
"$effmask_wrt" "$effmask_all" "$extern" "$extkind" "$extype" "$extype_struct" "$extval" "$lst"
"$lst_t" "$lst_vt" "$list" "$list_t" "$list_vt" "$rec" "$rec_t" "$rec_vt"
"$record" "$record_t" "$record_vt" "$tup" "$tup_t" "$tup_vt" "$tuple" "$tuple_t"
"$tuple_vt" "$raise" "$showtype" "$myfilename" "$mylocation" "$myfunction" "#assert" "#define"
"#elif" "#elifdef" "#elifndef" "#else" "#endif" "#error" "#if" "#ifdef"
"#ifndef" "#print" "#then" "#undef" "#include" "#staload" "#dynload" "#require"))
If you find some keyword, you can easily know how to use it on doc/EXAMPLE/ directory:
$ git clone https://github.com/githwxi/ATS-Postiats.git
$ cd ATS-Postiats/doc/EXAMPLE
$ grep -r "\$list" . | head
./MISC/word-chain.dats: $list{word}("", "")
./MISC/word-chain.dats: $list{word}("", "")
./MISC/mysendmailist.dats:$list{string}
./MISC/monad_list.dats: $list{a}("this", "that", "a")
./MISC/monad_list.dats: $list{a}("frog", "elephant", "thing")
./MISC/monad_list.dats: $list{a}("walked", "treaded", "grows")
./MISC/monad_list.dats: $list{a}("slowly", "quickly")
./ATSLF/CoYonedaLemma.dats:val myintlist0 = g0ofg1($list{int0}(I(1), I(0), I(1), I(0), I(0)))
./ATSLF/YonedaLemma.dats: $list{bool}(True, False, True, False, False)
./ATS-QA-LIST/qa-list-2014-12-07.dats:$list{double}(0.111111, 0.222222, 0.333333)
For a list0-value, you can do
val xs = g0ofg1($list{T}(x1, ..., xn))
where T is the type for the elements in xs. For instance,
val some_int_list = g0ofg1($list{int}(0, 9, 8, 7, 3, 4))
I want to modify the values in the gstreamer GstDebuglevel enumeration (You can find it in gst/gstinfo.h). Will it work if I simply change the enum values in the gstinfo.h or should I have to do any other modification? I want to give lower priority to debug related log dumps. How can I achieve the following.
I want something like this:
typedef enum {
GST_LEVEL_NONE = 0,
GST_LEVEL_ERROR = 1,
GST_LEVEL_WARNING = 2,
GST_LEVEL_FIXME = 3,
GST_LEVEL_INFO = 4,
GST_LEVEL_LOG = 6,
GST_LEVEL_TRACE = 7,
/* add more */
GST_LEVEL_MEMDUMP = 9,
/* add more */
GST_LEVEL_DEBUG = 10,
GST_LEVEL_COUNT
}GstDebugLevel;
Thanks in advance.
Changing the enum value and rebuilding gstreamer is enough.
I tested it with this enum:
typedef enum {
GST_LEVEL_NONE = 0,
GST_LEVEL_ERROR,
GST_LEVEL_WARNING,
GST_LEVEL_INFO,
GST_LEVEL_DEBUG=10,
GST_LEVEL_LOG=5,
GST_LEVEL_FIXME = 6,
GST_LEVEL_TRACE = 7,
/* add more */
GST_LEVEL_MEMDUMP = 9,
/* add more */
GST_LEVEL_COUNT
} GstDebugLevel;
And it did not output DEBUG level traces on the same GST_DEBUG value.